text stringlengths 8 4.13M |
|---|
use std::collections::HashMap;
use scraper::selector;
use scraper::{Html, Selector};
use crate::{
api::{ElementRef, ElementRefExt},
Error, NoneErrorExt, Result,
};
#[derive(Debug, PartialEq)]
pub enum UpcomingMatchTeam {
Name(String),
Tbd(String),
}
impl UpcomingMatchTeam {
// TODO: doc
pub fn from_element_ref(element: ElementRef) -> Result<Self> {
if let Some(name_elem) = element.select_one(".matchTeamName")? {
Ok(Self::Name(name_elem.text2()))
} else {
Ok(Self::Tbd(
element
.select_one(".team")?
.hltv_parse_err("Failed to find TBD team info")?
.text2(),
))
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpcomingMatchTeams {
Empty {
description: String,
},
Teams {
team1: UpcomingMatchTeam,
team2: UpcomingMatchTeam,
event: String,
},
}
#[derive(Debug, PartialEq)]
pub struct UpcomingMatch {
teams: UpcomingMatchTeams,
time: String, // TODO: normal time type
rating: usize, // num of stars
meta: String, // format
link: String,
}
impl UpcomingMatch {
// TODO: doc
pub fn from_element_ref(element: ElementRef) -> Result<Self> {
let link = element
.select_one("a")?
.hltv_parse_err("No 'a' element with link to upcoming match")?
.value()
.attr("href")
.hltv_parse_err("No href to upcoming match")?
.into();
let time = element
.select_one(".matchInfo>.matchTime")?
.hltv_parse_err("Failed to find match time")?
.text2();
let rating = element
.select(&Selector::parse(".matchInfo>.matchRating>.fa-star")?)
.filter(|elem| !elem.value().classes().any(|v| v == "faded"))
.count();
let meta = element
.select_one(".matchInfo>.matchMeta")?
.hltv_parse_err("Failed to get match meta (format)")?
.text2();
let teams = if let Some(elem) = element.select_one(".matchInfoEmpty>span")? {
UpcomingMatchTeams::Empty {
description: elem.text2(),
}
} else {
let event = element
.select_one(".matchEvent>.matchEventName")?
.hltv_parse_err("Failed to find event")?
.text2();
let team1 = UpcomingMatchTeam::from_element_ref(
element
.select_one(".matchTeams>.team1")?
.hltv_parse_err("Failed to find team1 element")?,
)?;
let team2 = UpcomingMatchTeam::from_element_ref(
element
.select_one(".matchTeams>.team2")?
.hltv_parse_err("Failed to find team2 element")?,
)?;
UpcomingMatchTeams::Teams {
team1,
team2,
event,
}
};
Ok(Self {
teams,
time,
rating,
meta,
link,
})
}
}
pub struct UpcomingMatches {
pub results: HashMap<String, Vec<UpcomingMatch>>,
}
impl UpcomingMatches {
// TODO: doc
pub fn from_html(document: &Html) -> Result<Self> {
document
.select(&Selector::parse(
".upcomingMatchesContainer>div>div.upcomingMatchesSection",
)?)
.map(|element| {
let day = element
.select_one(".matchDayHeadline")? // Seems like it changes from div to span in JS
.hltv_parse_err("Failed to find match day headline")?
.text2();
let results = element
.select(&Selector::parse("div.upcomingMatch")?)
.map(|x| UpcomingMatch::from_element_ref(x))
.collect::<Result<Vec<_>>>()?;
Ok((day, results))
})
.collect::<Result<HashMap<_, _>>>()
.map(|results| Self { results })
}
}
#[cfg(test)]
mod tests {
use super::*;
use scraper::{Html, Selector};
fn get_elem<'a>(html: &'a Html, css_selector: &'_ str) -> ElementRef<'a> {
html.select(&Selector::parse(css_selector).unwrap())
.next()
.unwrap()
}
#[test]
fn parse_upcoming_match_team() {
let html = Html::parse_fragment(
r#"
<div class="matchTeam team1">
<div class="matchTeamLogoContainer"><img alt="NiP" src="https://img-cdn.hltv.org/teamlogo/BSmtTpoXWe5bkSQ1Xk9bBQ.svg?ixlib=java-2.1.0&s=a0edf9bc3edb8680461c858fa21fe7fe" class="matchTeamLogo" title="NiP"></div>
<div class="matchTeamName text-ellipsis">NiP</div>
</div>
"#,
);
assert_eq!(
UpcomingMatchTeam::from_element_ref(get_elem(&html, "div")),
Ok(UpcomingMatchTeam::Name("NiP".into()))
);
}
#[test]
fn parse_upcoming_match_team_tbd() {
let html = Html::parse_fragment(
r#"
<div class="matchTeam team2">
<div class="team text-ellipsis">ENCE/BIG winner</div>
</div>
"#,
);
assert_eq!(
UpcomingMatchTeam::from_element_ref(get_elem(&html, "div")),
Ok(UpcomingMatchTeam::Tbd("ENCE/BIG winner".into()))
);
}
#[test]
fn parse_upcoming_match_info() {
let html = Html::parse_fragment(
r#"
<div class="upcomingMatch removeBackground" data-zonedgrouping-entry-unix="1605547800000" stars="1" lan="false" filteraslive="false" team1="4411">
<a href="/matches/2345214/nip-vs-ence-big-winner-iem-beijing-haidian-2020-europe" class="match a-reset">
<div class="matchInfo">
<div class="matchTime" data-time-format="HH:mm" data-unix="1605547800000">20:30</div>
<div class="matchRating"><i class="fa fa-star"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i></div>
<div class="matchMeta">bo3</div>
</div>
<div class="matchTeams text-ellipsis">
<div class="matchTeam team1">
<div class="matchTeamLogoContainer"><img alt="NiP" src="https://img-cdn.hltv.org/teamlogo/BSmtTpoXWe5bkSQ1Xk9bBQ.svg?ixlib=java-2.1.0&s=a0edf9bc3edb8680461c858fa21fe7fe" class="matchTeamLogo" title="NiP"></div>
<div class="matchTeamName text-ellipsis">NiP</div>
</div>
<div class="matchTeam team2">
<div class="team text-ellipsis">ENCE/BIG winner</div>
</div>
</div>
<div class="matchEvent">
<div class="matchEventLogoContainer"><img alt="IEM Beijing-Haidian 2020 Europe" src="https://static.hltv.org/images/eventLogos/5524.png" class="matchEventLogo" title="IEM Beijing-Haidian 2020 Europe"></div>
<div class="matchEventName gtSmartphone-only">IEM Beijing-Haidian 2020 Europe</div>
</div>
</a>s/2345214/nip-vs-ence-big-winner-iem-beijing-haidian-2020-europe" class="matchAnalytics" title="Analytics">
<div class="analyticsLink"><i class="fa fa-bar-chart"></i><span class="gtSmartphone-only">A</span></div>
</a>
</div>
"#,
);
assert_eq!(
UpcomingMatch::from_element_ref(get_elem(&html, "div")),
Ok(UpcomingMatch {
teams: UpcomingMatchTeams::Teams {
team1: UpcomingMatchTeam::Name("NiP".into()),
team2: UpcomingMatchTeam::Tbd("ENCE/BIG winner".into()),
event: "IEM Beijing-Haidian 2020 Europe".into(),
},
time: "20:30".into(),
rating: 1,
meta: "bo3".into(),
link: "/matches/2345214/nip-vs-ence-big-winner-iem-beijing-haidian-2020-europe"
.into(),
})
);
}
#[test]
fn parse_day_results() {
let html = Html::parse_fragment(
r#"
<hltv>
<div class="standardPageGrid">
<div class="mainContent">
<div class="liveMatchesSection">
<div class="headline-flex no-shadow">
<h2 class="upcoming-headline">Live CS:GO matches</h2>
<div><i class="star-filter-btn matchpage-star-unselected fa fa-star-o" title="Enable match filter"></i><i class="star-filter-btn matchpage-star-selected fa fa-star" title="Disable match filter" style="display: none;"></i></div>
</div>
<div class="mach-filter-wrapper">
<div class="match-filter">
<div class="match-filter-box">
<div class="filter-main-content"><a href="/matches" class="filter-button-link">
<div class="filter-button selected">
<div class="icon"><img src="img/static/gfx/cs_icon_active_day.png" class="day-only custom-icon"><img src="img/static/gfx/cs_icon_active_night.png" class="night-only custom-icon"></div>
<div class="button-title">All matches</div>
</div>
</a><a href="/matches?predefinedFilter=top_tier" class="filter-button-link">
<div class="filter-button ">
<div class="icon"><i class="fa fa-star"></i></div>
<div class="button-title">Top tier</div>
</div>
</a><a href="/matches?predefinedFilter=lan_only" class="filter-button-link">
<div class="filter-button ">
<div class="icon"><i class="fa fa-desktop"></i></div>
<div class="button-title">LAN</div>
</div>
</a>
<div class="filter-button custom ">
<div class="icon"><i class="fa fa-trophy"></i></div>
<div class="button-title">Event</div>
</div>
<div class="extraSpacer smartphone-only"></div>
</div>
</div>
<div class="filter-custom-content ">
<div class="event-type">
<div class="custom-content-header">Event type</div>
<div><a href="/matches?eventType=All" class="event-filter-link active">All</a><a href="/matches?eventType=Lan" class="event-filter-link ">Lan</a><a href="/matches?eventType=Online" class="event-filter-link ">Online</a></div>
</div>
<div class="event">
<div class="custom-content-header">Event</div>
<div class="events-container"><a href="/matches?event=5602" class="filter-button-link">
<div class="event-button tooltip-parent"><img alt="BLAST Premier Spring Groups 2021" src="https://img-cdn.hltv.org/eventlogo/O8dyTstiXZp1wPIcOGi_GC.png?ixlib=java-2.1.0&s=c414e930b554c2cba8f1098fa3619d51" class="event-logo" title="">
<div class="featured-event-tooltip">
<div class="featured-event-tooltip-content">BLAST Premier Spring Groups 2021</div>
</div>
</div>
</a><a href="/matches?event=5671" class="filter-button-link">
<div class="event-button tooltip-parent"><img alt="IEM Katowice 2021 Play-In" src="https://img-cdn.hltv.org/eventlogo/_a7BE4dbvKVdBFTDaTPULq.png?ixlib=java-2.1.0&s=f83842b885fe6bf00fc8e75a501ee955" class="event-logo" title="">
<div class="featured-event-tooltip">
<div class="featured-event-tooltip-content">IEM Katowice 2021 Play-In</div>
</div>
</div>
</a><a href="/matches?event=5701" class="filter-button-link">
<div class="event-button tooltip-parent"><img alt="ESEA Premier Season 36 Europe" src="https://img-cdn.hltv.org/eventlogo/b75aNG0i4UVPNQHX_Tq-Zq.png?ixlib=java-2.1.0&s=a41982a53b2a3d56ca657c6f6335259d" class="event-logo" title="">
<div class="featured-event-tooltip">
<div class="featured-event-tooltip-content">ESEA Premier Season 36 Europe</div>
</div>
</div>
</a><a href="/matches?event=5704" class="filter-button-link">
<div class="event-button tooltip-parent"><img alt="ESEA Premier Season 36 North America" src="https://img-cdn.hltv.org/eventlogo/Fu5w0q5fm_JedUt4Trlx39.png?ixlib=java-2.1.0&s=116ecf0d78dec2bcafafa861f8398c93" class="event-logo" title="">
<div class="featured-event-tooltip">
<div class="featured-event-tooltip-content">ESEA Premier Season 36 North America</div>
</div>
</div>
</a>
<div class="event-custom-container">
<div class="event-button expand-event-button event-filter-btn ">...</div>
<div class="event-filter-popup"><a href="/matches?event=5727" class="filter-button-link event-row">
<div class="event-img"><img alt="European Development Championship 2" src="https://img-cdn.hltv.org/eventlogo/fUUnE-XkcPKbEohf3bvgsl.png?ixlib=java-2.1.0&s=3c5518b338c4c4c22757a29051dd2bcb" title="European Development Championship 2"></div>
<div class="event-name">European Development Championship 2</div>
heckbox" class="event-checkbox">
<div class="container-overlay"></div>
</a><a href="/matches?event=5725" class="filter-button-link event-row">
<div class="event-img"><img alt="WESG 2021 LatAm South" src="https://img-cdn.hltv.org/eventlogo/DvZDZiwawcnDV1AcWyNn4m.png?ixlib=java-2.1.0&s=fcefa5d8451b27327772fb9963037e69" title="WESG 2021 LatAm South"></div>
<div class="event-name">WESG 2021 LatAm South</div>
heckbox" class="event-checkbox">
<div class="container-overlay"></div>
</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="liveMatchesContainer">
<div class="liveMatches" data-scorebot-url="https://scorebot-lb.hltv.org">
<div class="liveMatch-container" data-scorebot-id="2346342" data-team1-id="4608" data-team2-id="6667" data-hide-map-before-live="true" data-maps="Inferno,Nuke,Train" stars="2" lan="false" filteraslive="true" team1="4608" team2="6667">
<div class="liveMatch" data-livescore-match="2346342"><a href="/matches/2346342/natus-vincere-vs-faze-blast-premier-spring-groups-2021" class="match a-reset">
<div class="matchInfo">
<div class="matchTime matchLive">LIVE</div>
<div class="matchRating matchLive"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i></div>
<div class="matchMeta">bo3</div>
</div>
<div class="matchTeams text-ellipsis">
<div class="matchTeam">
<div class="matchTeamLogoContainer"><img alt="Natus Vincere" src="https://img-cdn.hltv.org/teamlogo/kixzGZIb9IYAAv-1vGrGev.svg?ixlib=java-2.1.0&s=8f9986a391fcb1adfbfff021b824a937" class="matchTeamLogo" title="Natus Vincere"></div>
<div class="matchTeamName text-ellipsis">Natus Vincere</div>
<div class="matchTeamScore"><span class="currentMapScore leading" data-livescore-current-map-score="" data-livescore-team="4608"> 5</span><span class="mapScore"> (<span data-livescore-maps-won-for="" data-livescore-team="4608" class="none">0</span>)</span></div>
</div>
<div class="matchTeam">
<div class="matchTeamLogoContainer"><img alt="FaZe" src="https://img-cdn.hltv.org/teamlogo/SMhzsxzbkIrgqCOOKGRXlW.svg?ixlib=java-2.1.0&s=e6a9ce0345c7d703e5eaac14307f69aa" class="matchTeamLogo" title="FaZe"></div>
<div class="matchTeamName text-ellipsis">FaZe</div>
<div class="matchTeamScore"><span class="currentMapScore trailing" data-livescore-current-map-score="" data-livescore-team="6667"> 4</span><span class="mapScore"> (<span data-livescore-maps-won-for="" data-livescore-team="6667" class="none">0</span>)</span></div>
</div>
</div>
<div class="matchEvent ">
<div class="matchEventLogoContainer"><img alt="BLAST Premier Spring Groups 2021" src="https://img-cdn.hltv.org/eventlogo/O8dyTstiXZp1wPIcOGi_GC.png?ixlib=java-2.1.0&s=c414e930b554c2cba8f1098fa3619d51" class="matchEventLogo" title="BLAST Premier Spring Groups 2021"></div>
<div class="matchEventName gtSmartphone-only">BLAST Premier Spring Groups 2021</div>
</div>
betting/analytics/2346342/natus-vincere-vs-faze-blast-premier-spring-groups-2021" class="matchAnalytics" title="Analytics">
<div class="analyticsLink"><i class="fa fa-bar-chart"></i><span class="gtSmartphone-only">A</span></div>
</a></div>
<div class="scorebot-container" id="matchScorebotId2346342"></div>
<div class="expand-match-btn">Expand</div>
</div>
<div class="liveMatch-container" data-scorebot-id="2346452" data-team1-id="8963" data-team2-id="8135" data-hide-map-before-live="true" data-maps="Dust2,Nuke,Inferno" stars="0" lan="false" filteraslive="true" team1="8963" team2="8135">
<div class="liveMatch" data-livescore-match="2346452"><a href="/matches/2346452/lyngby-vikings-vs-forze-european-development-championship-2" class="match a-reset">
<div class="matchInfo">
<div class="matchTime matchLive">LIVE</div>
<div class="matchRating matchLive"><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i></div>
<div class="matchMeta">bo3</div>
</div>
<div class="matchTeams text-ellipsis">
<div class="matchTeam">
<div class="matchTeamLogoContainer"><img alt="Lyngby Vikings" src="https://img-cdn.hltv.org/teamlogo/-VPKbzCklmJ9QntObIRT7u.svg?ixlib=java-2.1.0&s=1eff5dfa200b8f6cf286135a131ccd94" class="matchTeamLogo" title="Lyngby Vikings"></div>
<div class="matchTeamName text-ellipsis">Lyngby Vikings</div>
<div class="matchTeamScore"><span class="currentMapScore trailing" data-livescore-current-map-score="" data-livescore-team="8963"> 7</span><span class="mapScore"> (<span data-livescore-maps-won-for="" data-livescore-team="8963" class="trailing">0</span>)</span></div>
</div>
<div class="matchTeam">
<div class="matchTeamLogoContainer"><img alt="forZe" src="https://img-cdn.hltv.org/teamlogo/Qnpb1nBNLJUCyf4fRMFbzr.svg?ixlib=java-2.1.0&s=a798b973c429361844ee174e07ae2401" class="matchTeamLogo" title="forZe"></div>
<div class="matchTeamName text-ellipsis">forZe</div>
<div class="matchTeamScore"><span class="currentMapScore leading" data-livescore-current-map-score="" data-livescore-team="8135"> 9</span><span class="mapScore"> (<span data-livescore-maps-won-for="" data-livescore-team="8135" class="leading">1</span>)</span></div>
</div>
</div>
<div class="matchEvent ">
<div class="matchEventLogoContainer"><img alt="European Development Championship 2" src="https://img-cdn.hltv.org/eventlogo/fUUnE-XkcPKbEohf3bvgsl.png?ixlib=java-2.1.0&s=3c5518b338c4c4c22757a29051dd2bcb" class="matchEventLogo" title="European Development Championship 2"></div>
<div class="matchEventName gtSmartphone-only">European Development Championship 2</div>
</div>
betting/analytics/2346452/lyngby-vikings-vs-forze-european-development-championship-2" class="matchAnalytics" title="Analytics">
<div class="analyticsLink"><i class="fa fa-bar-chart"></i><span class="gtSmartphone-only">A</span></div>
</a></div>
<div class="scorebot-container" id="matchScorebotId2346452"></div>
<div class="expand-match-btn">Expand</div>
</div>
</div>
</div>
</div>
<div class="headline-flex">
<h1 class="upcoming-headline">Upcoming CS:GO matches</h1>
</div>
<div class="upcomingMatchesWrapper">
<div class="upcomingMatchesContainer">
<div class="" data-zonedgrouping-headline-format="EEEE - yyyy-MM-dd" data-zonedgrouping-headline-classes="matchDayHeadline" data-zonedgrouping-group-classes="upcomingMatchesSection">
<div class="upcomingMatchesSection">
<div class="matchDayHeadline">Saturday - 2021-02-13</div>
<div class="upcomingMatch removeBackground" data-zonedgrouping-entry-unix="1613241000000" stars="2" lan="false" filteraslive="false" team1="9215" team2="5973">
<a href="/matches/2346343/mibr-vs-liquid-blast-premier-spring-groups-2021" class="match a-reset">
<div class="matchInfo">
<div class="matchTime" data-time-format="HH:mm" data-unix="1613241000000">21:30</div>
<div class="matchRating"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i></div>
<div class="matchMeta">bo3</div>
</div>
<div class="matchTeams text-ellipsis">
<div class="matchTeam team1">
<div class="matchTeamLogoContainer"><img alt="MIBR" src="https://img-cdn.hltv.org/teamlogo/sVnH-oAf1J5TnMwoY4cxUC.png?ixlib=java-2.1.0&w=50&s=b0ef463fa0f1638bce72a89590fbaddf" class="matchTeamLogo day-only" title="MIBR"><img alt="MIBR" src="https://img-cdn.hltv.org/teamlogo/m_JQ624LNFHWiUY-25uuaE.png?ixlib=java-2.1.0&w=50&s=80a1e479dd1b15b974d3e2d5588763af" class="matchTeamLogo night-only" title="MIBR"></div>
<div class="matchTeamName text-ellipsis">MIBR</div>
</div>
<div class="matchTeam team2">
<div class="matchTeamLogoContainer"><img alt="Liquid" src="https://img-cdn.hltv.org/teamlogo/JMeLLbWKCIEJrmfPaqOz4O.svg?ixlib=java-2.1.0&s=c02caf90234d3a3ebac074c84ba1ea62" class="matchTeamLogo" title="Liquid"></div>
<div class="matchTeamName text-ellipsis">Liquid</div>
</div>
</div>
<div class="matchEvent">
<div class="matchEventLogoContainer"><img alt="BLAST Premier Spring Groups 2021" src="https://img-cdn.hltv.org/eventlogo/O8dyTstiXZp1wPIcOGi_GC.png?ixlib=java-2.1.0&s=c414e930b554c2cba8f1098fa3619d51" class="matchEventLogo" title="BLAST Premier Spring Groups 2021"></div>
<div class="matchEventName gtSmartphone-only">BLAST Premier Spring Groups 2021</div>
</div>
betting/analytics/2346343/mibr-vs-liquid-blast-premier-spring-groups-2021" class="matchAnalytics" title="Analytics">
<div class="analyticsLink"><i class="fa fa-bar-chart"></i><span class="gtSmartphone-only">A</span></div>
</a></div></div><div class="upcomingMatchesSection"><div class="matchDayHeadline">Sunday - 2021-02-14</div><div class="upcomingMatch removeBackground" data-zonedgrouping-entry-unix="1613316600000" stars="2" lan="false" filteraslive="false"><a href="/matches/2346344/blast-premier-spring-groups-2021-group-c-consolidation-final-blast-premier-spring-groups-2021" class="match a-reset">
<div class="matchInfo">
<div class="matchTime" data-time-format="HH:mm" data-unix="1613316600000">18:30</div>
<div class="matchRating"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i></div>
<div class="matchMeta">bo3</div>
</div>
<div class="matchInfoEmpty"><span class="line-clamp-3">BLAST Premier Spring Groups 2021 - Group C Consolidation Final</span></div>
betting/analytics/2346344/blast-premier-spring-groups-2021-group-c-consolidation-final-blast-premier-spring-groups-2021" class="matchAnalytics" title="Analytics">
<div class="analyticsLink"><i class="fa fa-bar-chart"></i><span class="gtSmartphone-only">A</span></div>
</a></div><div class="upcomingMatch removeBackground oddRowBgColor" data-zonedgrouping-entry-unix="1613331000000" stars="2" lan="false" filteraslive="false"><a href="/matches/2346345/blast-premier-spring-groups-2021-group-c-final-blast-premier-spring-groups-2021" class="match a-reset">
<div class="matchInfo">
<div class="matchTime" data-time-format="HH:mm" data-unix="1613331000000">22:30</div>
<div class="matchRating"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i></div>
<div class="matchMeta">bo3</div>
</div>
<div class="matchInfoEmpty"><span class="line-clamp-3">BLAST Premier Spring Groups 2021 - Group C Final</span></div>
betting/analytics/2346345/blast-premier-spring-groups-2021-group-c-final-blast-premier-spring-groups-2021" class="matchAnalytics" title="Analytics">
<div class="analyticsLink"><i class="fa fa-bar-chart"></i><span class="gtSmartphone-only">A</span></div>
</a></div></div><div class="upcomingMatchesSection"><div class="matchDayHeadline">Thursday - 2021-03-04</div><div class="upcomingMatch removeBackground" data-zonedgrouping-entry-unix="1614880800000" stars="0" lan="false" filteraslive="false" team1="9863" team2="6978"><a href="/matches/2346506/fate-vs-singularity-esea-premier-season-36-europe" class="match a-reset">
<div class="matchInfo">
<div class="matchTime" data-time-format="HH:mm" data-unix="1614880800000">21:00</div>
<div class="matchRating"><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i><i class="fa fa-star faded"></i></div>
<div class="matchMeta">bo3</div>
</div>
<div class="matchTeams text-ellipsis">
<div class="matchTeam team1">
<div class="matchTeamLogoContainer"><img alt="FATE" src="https://img-cdn.hltv.org/teamlogo/N2kh0YzH5DEk2tnOUAXtx6.png?ixlib=java-2.1.0&w=50&s=9f0542fa00872a3f0bf449aa502ef364" class="matchTeamLogo" title="FATE"></div>
<div class="matchTeamName text-ellipsis">FATE</div>
</div>
<div class="matchTeam team2">
<div class="matchTeamLogoContainer"><img alt="Singularity" src="https://img-cdn.hltv.org/teamlogo/C1Nyy0ZcMxR_iUlJFLtUW7.svg?ixlib=java-2.1.0&s=d18bb6c2a85a032f371a14a10207f183" class="matchTeamLogo" title="Singularity"></div>
<div class="matchTeamName text-ellipsis">Singularity</div>
</div>
</div>
<div class="matchEvent">
<div class="matchEventLogoContainer"><img alt="ESEA Premier Season 36 Europe" src="https://img-cdn.hltv.org/eventlogo/b75aNG0i4UVPNQHX_Tq-Zq.png?ixlib=java-2.1.0&s=a41982a53b2a3d56ca657c6f6335259d" class="matchEventLogo" title="ESEA Premier Season 36 Europe"></div>
<div class="matchEventName gtSmartphone-only">ESEA Premier Season 36 Europe</div>
</div>
betting/analytics/2346506/fate-vs-singularity-esea-premier-season-36-europe" class="matchAnalytics" title="Analytics">
<div class="analyticsLink"><i class="fa fa-bar-chart"></i><span class="gtSmartphone-only">A</span></div>
</a></div></div></div>
<div class="match-filter-empty-warning newMatchesEmptystateContainer " style="display: none;">Matches with selected filter are hidden. Disable your match filter to view all matches.
<div class="match-filter-warning-disable-container"><span class="match-filter-warning-disable" style="display: none;"><i class="fa fa-star"></i>Disable starfilter</span></div>
</div>
</div>
</div>
</div>
</div>
</hltv>
"#,
);
let res = UpcomingMatches::from_html(&html).unwrap();
assert_eq!(res.results.len(), 3);
assert_eq!(res.results["Saturday - 2021-02-13"].len(), 1);
assert_eq!(res.results["Sunday - 2021-02-14"].len(), 2);
}
}
|
use crate::{
encryption::ElGamal,
helper::Helper,
types::{Cipher, ModuloOperations, PublicKey},
};
use num_bigint::BigUint;
use num_traits::One;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
#[derive(Clone, Eq, PartialEq, Debug, Hash)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct ReEncryptionProof {
pub c_one_prime: Cipher,
pub challenge: BigUint,
pub h1: BigUint,
pub h2: BigUint,
pub s2: BigUint,
pub t2: BigUint,
}
/// Implements a designated verifier zero-knowledge proof
/// for a multiplicative ElGamal re-encryption
impl ReEncryptionProof {
/// Comment this function
pub fn generate(
r1: &BigUint, // random value r1 that was used to re_encrypt
r2: &BigUint,
h2: &BigUint,
s2: &BigUint,
c_one: &Cipher, // publicly known encryption of 1 using r1
pk: &PublicKey,
) -> ReEncryptionProof {
// common parameters
let p = &pk.params.p;
let q = &pk.params.q();
let g = &pk.params.g;
let h = &pk.h;
// compute new random encryption of one
let one = BigUint::one();
let c_one_prime = ElGamal::encrypt(&one, r2, pk);
// generate the commitment
// t2 = g^s2 * pk^-h2 mod p = g^s2 / pk^h2 mod p
let g_pow_s2 = g.modpow(s2, p);
let pk_pow_h2 = h.modpow(h2, p);
let t2 = g_pow_s2
.moddiv(&pk_pow_h2, p)
.expect("cannot compute mod_inverse in mod_div!");
// generate the challenge -> hash the commitment + the public values
let mut h =
Helper::hash_re_encryption_proof_inputs("re_encryption", c_one, &c_one_prime, &t2);
h %= q;
// split the hash into two parts h1 = h - h2
let h1 = h.modsub(h2, q);
// compute the challenge
let challenge = h1.modmul(r1, q).modadd(r2, q);
ReEncryptionProof {
c_one_prime,
challenge,
h1,
h2: h2.clone(),
s2: s2.clone(),
t2,
}
}
/// Comment this Function
pub fn verify(
pk: &PublicKey,
proof: &ReEncryptionProof,
cipher: &Cipher,
re_enc_cipher: &Cipher,
) -> bool {
// common parameters
let p = &pk.params.p;
let g = &pk.params.g;
let q = &pk.params.q();
// deconstruct the proof
let challenge = &proof.challenge;
let c_one_prime = &proof.c_one_prime;
let h1 = &proof.h1;
let h2 = &proof.h2;
let s2 = &proof.s2;
let t2 = &proof.t2;
// recompute c_one -> publicly known encryption of 1 using r1
// by homomorphically subtracting the re-encryption from the original ballot
// in a multiplicative homomorphic ElGamal encryption this results in a division
let c_one = ElGamal::homomorphic_subtraction(re_enc_cipher, cipher, p);
// recompute the hash
let mut h_prime =
Helper::hash_re_encryption_proof_inputs("re_encryption", &c_one, c_one_prime, t2);
h_prime %= q;
// add the two hash parts from the prover
let h = h1.modadd(h2, q);
// verify that the hashes are the same
let v1 = h_prime == h;
// verify the commitment: E(1,challenge) = h1 * c_one homomorphic_addition c_one_prime
// 1. compute the left hand side E(1,challenge)
let one = BigUint::one();
let lhs = ElGamal::encrypt(&one, challenge, pk);
// 2. compute the right hand side h1 * c_one homomorphic_addition c_one_prime
let h1_c_one = ElGamal::homomorphic_multiply(&c_one, h1, p);
let rhs = ElGamal::homomorphic_addition(&h1_c_one, c_one_prime, p);
// verify that lhs == rhs
let v2 = lhs == rhs;
// 3. test: verify that g^s2 == pk^c2 * t2
let lhs = g.modpow(s2, p);
let pk_pow_h2 = pk.h.modpow(h2, p);
let rhs = pk_pow_h2.modmul(t2, p);
// verify that lhs == rhs
let v3 = lhs == rhs;
// the proof is correct if all three checks pass
v1 && v2 && v3
}
}
#[cfg(test)]
mod tests {
use crate::{
encryption::ElGamal, helper::Helper, proofs::re_encryption::ReEncryptionProof,
random::Random,
};
use num_bigint::BigUint;
use num_traits::One;
#[test]
fn it_should_verify_re_encryption_proofs() {
// test setup
let (params, _, pk) = Helper::setup_sm_system();
let q = ¶ms.q();
// chose a number of random votes
let votes = vec![
BigUint::from(1u32),
BigUint::from(2u32),
BigUint::from(3u32),
BigUint::from(13u32),
];
for vote in votes {
// 1. the voter encrypts his vote
let r0 = Random::get_random_less_than(q);
let ballot = ElGamal::encrypt(&vote, &r0, &pk);
// 2. the randomizer re-encrypts the ballot
let r1 = Random::get_random_less_than(q);
let ballot_prime = ElGamal::re_encrypt(&ballot, &r1, &pk);
// 3. the randomizer generates a proof to show that the re-encryption is valid
// 3.1 generate c_one -> the encryption of 1 using the re-encryption random r1
let one = BigUint::one();
let c_one = ElGamal::encrypt(&one, &r1, &pk);
// 3.2 generate the proof
let r2 = Random::get_random_less_than(q);
let h2 = Random::get_random_less_than(q);
let s2 = Random::get_random_less_than(q);
let proof = ReEncryptionProof::generate(&r1, &r2, &h2, &s2, &c_one, &pk);
// 4. the voter verifies the re-encryption proof
let proof_is_valid = ReEncryptionProof::verify(&pk, &proof, &ballot, &ballot_prime);
assert!(proof_is_valid);
}
}
}
|
fn main() {
// In general, the `{}` will be automatically replaced with any
// arguments. These will be stringified.
println!("{} days", 31);
// Positional arguments can be used. Specifying an integer inside `{}`
// determines which additional argument will be replaced. Arguments start
// at 0 immediately after the format string
println!("{0}, this is {1}. {1}, this is {0}", "Alice", "Bob");
// As can named arguments.
println!("{subject} {verb} {object}",
object="the lazy dog",
subject="the quick brown fox",
verb="jumps over");
// Different formatting can be invoked by specifying the format character after a
// `:`.
println!("Base 10: {}", 69420); //69420
println!("Base 2 (binary): {:b}", 69420); //10000111100101100
println!("Base 8 (octal): {:o}", 69420); //207454
println!("Base 16 (hexadecimal): {:x}", 69420); //10f2c
println!("Base 16 (hexadecimal): {:X}", 69420); //10F2C
// You can right-justify text with a specified width. This will
// output " 1". (Four white spaces and a "1", for a total width of 5.)
println!("{number:>5}", number=1);
// You can pad numbers with extra zeroes,
//and left-adjust by flipping the sign. This will output "10000".
println!("{number:0<5}", number=1);
// You can use named arguments in the format specifier by appending a `$`
println!("{number:0>width$}", number=1, width=5);
// Rust even checks to make sure the correct number of arguments are
// used.
println!("My name is {0}, {1} {0}", "Bond", "James");
// FIXME ^ Add the missing argument: "James"
// Only types that implement fmt::Display can be formatted with `{}`. User-
// defined types do not implement fmt::Display by default
#[allow(dead_code)]
struct Structure(i32);
// This will not compile because `Structure` does not implement
// fmt::Display
// println!("This struct `{}` won't print...", Structure(3));
// TODO ^ Try uncommenting this line
// For Rust 1.58 and above, you can directly capture the argument from a
// surrounding variable. Just like the above, this will output
// " 1". 5 white spaces and a "1".
let number: f64 = 1.0;
let width: usize = 5;
println!("{number:>width$}");
// Print the pi
let pi = 3.141592;
println!("{pi:.3}")
} |
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::SLVCTL {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = "Possible values of the field `SlvContinue`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SLVCONTINUER {
#[doc = "No effect."]
NO_EFFECT_,
#[doc = "Continue. Informs the Slave function to continue to the next operation. This must done after writing transmit data, reading received data, or any other housekeeping related to the next bus operation."]
CONTINUE_INFORMS_TH,
}
impl SLVCONTINUER {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
SLVCONTINUER::NO_EFFECT_ => false,
SLVCONTINUER::CONTINUE_INFORMS_TH => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> SLVCONTINUER {
match value {
false => SLVCONTINUER::NO_EFFECT_,
true => SLVCONTINUER::CONTINUE_INFORMS_TH,
}
}
#[doc = "Checks if the value of the field is `NO_EFFECT_`"]
#[inline]
pub fn is_no_effect_(&self) -> bool {
*self == SLVCONTINUER::NO_EFFECT_
}
#[doc = "Checks if the value of the field is `CONTINUE_INFORMS_TH`"]
#[inline]
pub fn is_continue_informs_th(&self) -> bool {
*self == SLVCONTINUER::CONTINUE_INFORMS_TH
}
}
#[doc = "Possible values of the field `SlvNack`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SLVNACKR {
#[doc = "No effect."]
NO_EFFECT_,
#[doc = "Nack. Causes the Slave function to Nack the master when the slave is receiving data from the master (Slave Receiver mode)."]
NACK_CAUSES_THE_SLA,
}
impl SLVNACKR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
SLVNACKR::NO_EFFECT_ => false,
SLVNACKR::NACK_CAUSES_THE_SLA => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> SLVNACKR {
match value {
false => SLVNACKR::NO_EFFECT_,
true => SLVNACKR::NACK_CAUSES_THE_SLA,
}
}
#[doc = "Checks if the value of the field is `NO_EFFECT_`"]
#[inline]
pub fn is_no_effect_(&self) -> bool {
*self == SLVNACKR::NO_EFFECT_
}
#[doc = "Checks if the value of the field is `NACK_CAUSES_THE_SLA`"]
#[inline]
pub fn is_nack_causes_the_sla(&self) -> bool {
*self == SLVNACKR::NACK_CAUSES_THE_SLA
}
}
#[doc = "Values that can be written to the field `SlvContinue`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SLVCONTINUEW {
#[doc = "No effect."]
NO_EFFECT_,
#[doc = "Continue. Informs the Slave function to continue to the next operation. This must done after writing transmit data, reading received data, or any other housekeeping related to the next bus operation."]
CONTINUE_INFORMS_TH,
}
impl SLVCONTINUEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
SLVCONTINUEW::NO_EFFECT_ => false,
SLVCONTINUEW::CONTINUE_INFORMS_TH => true,
}
}
}
#[doc = r" Proxy"]
pub struct _SLVCONTINUEW<'a> {
w: &'a mut W,
}
impl<'a> _SLVCONTINUEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: SLVCONTINUEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "No effect."]
#[inline]
pub fn no_effect_(self) -> &'a mut W {
self.variant(SLVCONTINUEW::NO_EFFECT_)
}
#[doc = "Continue. Informs the Slave function to continue to the next operation. This must done after writing transmit data, reading received data, or any other housekeeping related to the next bus operation."]
#[inline]
pub fn continue_informs_th(self) -> &'a mut W {
self.variant(SLVCONTINUEW::CONTINUE_INFORMS_TH)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 0;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `SlvNack`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SLVNACKW {
#[doc = "No effect."]
NO_EFFECT_,
#[doc = "Nack. Causes the Slave function to Nack the master when the slave is receiving data from the master (Slave Receiver mode)."]
NACK_CAUSES_THE_SLA,
}
impl SLVNACKW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
SLVNACKW::NO_EFFECT_ => false,
SLVNACKW::NACK_CAUSES_THE_SLA => true,
}
}
}
#[doc = r" Proxy"]
pub struct _SLVNACKW<'a> {
w: &'a mut W,
}
impl<'a> _SLVNACKW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: SLVNACKW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "No effect."]
#[inline]
pub fn no_effect_(self) -> &'a mut W {
self.variant(SLVNACKW::NO_EFFECT_)
}
#[doc = "Nack. Causes the Slave function to Nack the master when the slave is receiving data from the master (Slave Receiver mode)."]
#[inline]
pub fn nack_causes_the_sla(self) -> &'a mut W {
self.variant(SLVNACKW::NACK_CAUSES_THE_SLA)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 1;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 0 - Slave Continue."]
#[inline]
pub fn slv_continue(&self) -> SLVCONTINUER {
SLVCONTINUER::_from({
const MASK: bool = true;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 1 - Slave Nack."]
#[inline]
pub fn slv_nack(&self) -> SLVNACKR {
SLVNACKR::_from({
const MASK: bool = true;
const OFFSET: u8 = 1;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 0 - Slave Continue."]
#[inline]
pub fn slv_continue(&mut self) -> _SLVCONTINUEW {
_SLVCONTINUEW { w: self }
}
#[doc = "Bit 1 - Slave Nack."]
#[inline]
pub fn slv_nack(&mut self) -> _SLVNACKW {
_SLVNACKW { w: self }
}
}
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Win32_Media_Audio_Apo")]
pub mod Apo;
#[cfg(feature = "Win32_Media_Audio_DirectMusic")]
pub mod DirectMusic;
#[cfg(feature = "Win32_Media_Audio_DirectSound")]
pub mod DirectSound;
#[cfg(feature = "Win32_Media_Audio_Endpoints")]
pub mod Endpoints;
#[cfg(feature = "Win32_Media_Audio_XAudio2")]
pub mod XAudio2;
pub const ACMDM_DRIVER_ABOUT: u32 = 24587u32;
pub const ACMDM_DRIVER_DETAILS: u32 = 24586u32;
pub const ACMDM_DRIVER_NOTIFY: u32 = 24577u32;
pub const ACMDM_FILTERTAG_DETAILS: u32 = 24626u32;
pub const ACMDM_FILTER_DETAILS: u32 = 24627u32;
pub const ACMDM_FORMATTAG_DETAILS: u32 = 24601u32;
pub const ACMDM_FORMAT_DETAILS: u32 = 24602u32;
pub const ACMDM_FORMAT_SUGGEST: u32 = 24603u32;
pub const ACMDM_HARDWARE_WAVE_CAPS_INPUT: u32 = 24596u32;
pub const ACMDM_HARDWARE_WAVE_CAPS_OUTPUT: u32 = 24597u32;
pub const ACMDM_RESERVED_HIGH: u32 = 28671u32;
pub const ACMDM_RESERVED_LOW: u32 = 24576u32;
pub const ACMDM_STREAM_CLOSE: u32 = 24653u32;
pub const ACMDM_STREAM_CONVERT: u32 = 24655u32;
pub const ACMDM_STREAM_OPEN: u32 = 24652u32;
pub const ACMDM_STREAM_PREPARE: u32 = 24657u32;
pub const ACMDM_STREAM_RESET: u32 = 24656u32;
pub const ACMDM_STREAM_SIZE: u32 = 24654u32;
pub const ACMDM_STREAM_UNPREPARE: u32 = 24658u32;
pub const ACMDM_STREAM_UPDATE: u32 = 24659u32;
pub const ACMDM_USER: u32 = 16384u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
pub struct ACMDRIVERDETAILSA {
pub cbStruct: u32,
pub fccType: u32,
pub fccComp: u32,
pub wMid: u16,
pub wPid: u16,
pub vdwACM: u32,
pub vdwDriver: u32,
pub fdwSupport: u32,
pub cFormatTags: u32,
pub cFilterTags: u32,
pub hicon: super::super::UI::WindowsAndMessaging::HICON,
pub szShortName: [super::super::Foundation::CHAR; 32],
pub szLongName: [super::super::Foundation::CHAR; 128],
pub szCopyright: [super::super::Foundation::CHAR; 80],
pub szLicensing: [super::super::Foundation::CHAR; 128],
pub szFeatures: [super::super::Foundation::CHAR; 512],
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
impl ACMDRIVERDETAILSA {}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
impl ::core::default::Default for ACMDRIVERDETAILSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
impl ::core::cmp::PartialEq for ACMDRIVERDETAILSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
impl ::core::cmp::Eq for ACMDRIVERDETAILSA {}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
unsafe impl ::windows::core::Abi for ACMDRIVERDETAILSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_UI_WindowsAndMessaging")]
pub struct ACMDRIVERDETAILSW {
pub cbStruct: u32,
pub fccType: u32,
pub fccComp: u32,
pub wMid: u16,
pub wPid: u16,
pub vdwACM: u32,
pub vdwDriver: u32,
pub fdwSupport: u32,
pub cFormatTags: u32,
pub cFilterTags: u32,
pub hicon: super::super::UI::WindowsAndMessaging::HICON,
pub szShortName: [u16; 32],
pub szLongName: [u16; 128],
pub szCopyright: [u16; 80],
pub szLicensing: [u16; 128],
pub szFeatures: [u16; 512],
}
#[cfg(feature = "Win32_UI_WindowsAndMessaging")]
impl ACMDRIVERDETAILSW {}
#[cfg(feature = "Win32_UI_WindowsAndMessaging")]
impl ::core::default::Default for ACMDRIVERDETAILSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_UI_WindowsAndMessaging")]
impl ::core::cmp::PartialEq for ACMDRIVERDETAILSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_UI_WindowsAndMessaging")]
impl ::core::cmp::Eq for ACMDRIVERDETAILSW {}
#[cfg(feature = "Win32_UI_WindowsAndMessaging")]
unsafe impl ::windows::core::Abi for ACMDRIVERDETAILSW {
type Abi = Self;
}
pub const ACMDRIVERDETAILS_COPYRIGHT_CHARS: u32 = 80u32;
pub const ACMDRIVERDETAILS_FEATURES_CHARS: u32 = 512u32;
pub const ACMDRIVERDETAILS_LICENSING_CHARS: u32 = 128u32;
pub const ACMDRIVERDETAILS_LONGNAME_CHARS: u32 = 128u32;
pub const ACMDRIVERDETAILS_SHORTNAME_CHARS: u32 = 32u32;
pub const ACMDRIVERDETAILS_SUPPORTF_ASYNC: i32 = 16i32;
pub const ACMDRIVERDETAILS_SUPPORTF_CODEC: i32 = 1i32;
pub const ACMDRIVERDETAILS_SUPPORTF_CONVERTER: i32 = 2i32;
pub const ACMDRIVERDETAILS_SUPPORTF_DISABLED: i32 = -2147483648i32;
pub const ACMDRIVERDETAILS_SUPPORTF_FILTER: i32 = 4i32;
pub const ACMDRIVERDETAILS_SUPPORTF_HARDWARE: i32 = 8i32;
pub const ACMDRIVERDETAILS_SUPPORTF_LOCAL: i32 = 1073741824i32;
#[cfg(feature = "Win32_Foundation")]
pub type ACMDRIVERENUMCB = unsafe extern "system" fn(hadid: HACMDRIVERID, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct ACMDRVFORMATSUGGEST {
pub cbStruct: u32,
pub fdwSuggest: u32,
pub pwfxSrc: *mut WAVEFORMATEX,
pub cbwfxSrc: u32,
pub pwfxDst: *mut WAVEFORMATEX,
pub cbwfxDst: u32,
}
impl ACMDRVFORMATSUGGEST {}
impl ::core::default::Default for ACMDRVFORMATSUGGEST {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for ACMDRVFORMATSUGGEST {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for ACMDRVFORMATSUGGEST {}
unsafe impl ::windows::core::Abi for ACMDRVFORMATSUGGEST {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct ACMDRVSTREAMHEADER {
pub cbStruct: u32,
pub fdwStatus: u32,
pub dwUser: usize,
pub pbSrc: *mut u8,
pub cbSrcLength: u32,
pub cbSrcLengthUsed: u32,
pub dwSrcUser: usize,
pub pbDst: *mut u8,
pub cbDstLength: u32,
pub cbDstLengthUsed: u32,
pub dwDstUser: usize,
pub fdwConvert: u32,
pub padshNext: *mut ACMDRVSTREAMHEADER,
pub fdwDriver: u32,
pub dwDriver: usize,
pub fdwPrepared: u32,
pub dwPrepared: usize,
pub pbPreparedSrc: *mut u8,
pub cbPreparedSrcLength: u32,
pub pbPreparedDst: *mut u8,
pub cbPreparedDstLength: u32,
}
impl ACMDRVSTREAMHEADER {}
impl ::core::default::Default for ACMDRVSTREAMHEADER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for ACMDRVSTREAMHEADER {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for ACMDRVSTREAMHEADER {}
unsafe impl ::windows::core::Abi for ACMDRVSTREAMHEADER {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct ACMDRVSTREAMINSTANCE {
pub cbStruct: u32,
pub pwfxSrc: *mut WAVEFORMATEX,
pub pwfxDst: *mut WAVEFORMATEX,
pub pwfltr: *mut WAVEFILTER,
pub dwCallback: usize,
pub dwInstance: usize,
pub fdwOpen: u32,
pub fdwDriver: u32,
pub dwDriver: usize,
pub has: HACMSTREAM,
}
impl ACMDRVSTREAMINSTANCE {}
impl ::core::default::Default for ACMDRVSTREAMINSTANCE {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for ACMDRVSTREAMINSTANCE {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for ACMDRVSTREAMINSTANCE {}
unsafe impl ::windows::core::Abi for ACMDRVSTREAMINSTANCE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct ACMDRVSTREAMSIZE {
pub cbStruct: u32,
pub fdwSize: u32,
pub cbSrcLength: u32,
pub cbDstLength: u32,
}
impl ACMDRVSTREAMSIZE {}
impl ::core::default::Default for ACMDRVSTREAMSIZE {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for ACMDRVSTREAMSIZE {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for ACMDRVSTREAMSIZE {}
unsafe impl ::windows::core::Abi for ACMDRVSTREAMSIZE {
type Abi = Self;
}
pub const ACMERR_BASE: u32 = 512u32;
pub const ACMERR_BUSY: u32 = 513u32;
pub const ACMERR_CANCELED: u32 = 515u32;
pub const ACMERR_NOTPOSSIBLE: u32 = 512u32;
pub const ACMERR_UNPREPARED: u32 = 514u32;
#[cfg(feature = "Win32_Foundation")]
impl ::core::clone::Clone for ACMFILTERCHOOSEA {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct ACMFILTERCHOOSEA {
pub cbStruct: u32,
pub fdwStyle: u32,
pub hwndOwner: super::super::Foundation::HWND,
pub pwfltr: *mut WAVEFILTER,
pub cbwfltr: u32,
pub pszTitle: super::super::Foundation::PSTR,
pub szFilterTag: [super::super::Foundation::CHAR; 48],
pub szFilter: [super::super::Foundation::CHAR; 128],
pub pszName: super::super::Foundation::PSTR,
pub cchName: u32,
pub fdwEnum: u32,
pub pwfltrEnum: *mut WAVEFILTER,
pub hInstance: super::super::Foundation::HINSTANCE,
pub pszTemplateName: super::super::Foundation::PSTR,
pub lCustData: super::super::Foundation::LPARAM,
pub pfnHook: ::core::option::Option<ACMFILTERCHOOSEHOOKPROCA>,
}
#[cfg(feature = "Win32_Foundation")]
impl ACMFILTERCHOOSEA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for ACMFILTERCHOOSEA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for ACMFILTERCHOOSEA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for ACMFILTERCHOOSEA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for ACMFILTERCHOOSEA {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[cfg(feature = "Win32_Foundation")]
pub type ACMFILTERCHOOSEHOOKPROCA = unsafe extern "system" fn(hwnd: super::super::Foundation::HWND, umsg: u32, wparam: super::super::Foundation::WPARAM, lparam: super::super::Foundation::LPARAM) -> u32;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFILTERCHOOSEHOOKPROCW = unsafe extern "system" fn(hwnd: super::super::Foundation::HWND, umsg: u32, wparam: super::super::Foundation::WPARAM, lparam: super::super::Foundation::LPARAM) -> u32;
#[cfg(feature = "Win32_Foundation")]
impl ::core::clone::Clone for ACMFILTERCHOOSEW {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct ACMFILTERCHOOSEW {
pub cbStruct: u32,
pub fdwStyle: u32,
pub hwndOwner: super::super::Foundation::HWND,
pub pwfltr: *mut WAVEFILTER,
pub cbwfltr: u32,
pub pszTitle: super::super::Foundation::PWSTR,
pub szFilterTag: [u16; 48],
pub szFilter: [u16; 128],
pub pszName: super::super::Foundation::PWSTR,
pub cchName: u32,
pub fdwEnum: u32,
pub pwfltrEnum: *mut WAVEFILTER,
pub hInstance: super::super::Foundation::HINSTANCE,
pub pszTemplateName: super::super::Foundation::PWSTR,
pub lCustData: super::super::Foundation::LPARAM,
pub pfnHook: ::core::option::Option<ACMFILTERCHOOSEHOOKPROCW>,
}
#[cfg(feature = "Win32_Foundation")]
impl ACMFILTERCHOOSEW {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for ACMFILTERCHOOSEW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for ACMFILTERCHOOSEW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for ACMFILTERCHOOSEW {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for ACMFILTERCHOOSEW {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
pub const ACMFILTERCHOOSE_STYLEF_CONTEXTHELP: i32 = 128i32;
pub const ACMFILTERCHOOSE_STYLEF_ENABLEHOOK: i32 = 8i32;
pub const ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE: i32 = 16i32;
pub const ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE: i32 = 32i32;
pub const ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT: i32 = 64i32;
pub const ACMFILTERCHOOSE_STYLEF_SHOWHELP: i32 = 4i32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct ACMFILTERDETAILSA {
pub cbStruct: u32,
pub dwFilterIndex: u32,
pub dwFilterTag: u32,
pub fdwSupport: u32,
pub pwfltr: *mut WAVEFILTER,
pub cbwfltr: u32,
pub szFilter: [super::super::Foundation::CHAR; 128],
}
#[cfg(feature = "Win32_Foundation")]
impl ACMFILTERDETAILSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for ACMFILTERDETAILSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for ACMFILTERDETAILSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for ACMFILTERDETAILSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for ACMFILTERDETAILSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct ACMFILTERDETAILSW {
pub cbStruct: u32,
pub dwFilterIndex: u32,
pub dwFilterTag: u32,
pub fdwSupport: u32,
pub pwfltr: *mut WAVEFILTER,
pub cbwfltr: u32,
pub szFilter: [u16; 128],
}
impl ACMFILTERDETAILSW {}
impl ::core::default::Default for ACMFILTERDETAILSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for ACMFILTERDETAILSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for ACMFILTERDETAILSW {}
unsafe impl ::windows::core::Abi for ACMFILTERDETAILSW {
type Abi = Self;
}
pub const ACMFILTERDETAILS_FILTER_CHARS: u32 = 128u32;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFILTERENUMCBA = unsafe extern "system" fn(hadid: HACMDRIVERID, pafd: *mut ACMFILTERDETAILSA, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFILTERENUMCBW = unsafe extern "system" fn(hadid: HACMDRIVERID, pafd: *mut ACMFILTERDETAILSW, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct ACMFILTERTAGDETAILSA {
pub cbStruct: u32,
pub dwFilterTagIndex: u32,
pub dwFilterTag: u32,
pub cbFilterSize: u32,
pub fdwSupport: u32,
pub cStandardFilters: u32,
pub szFilterTag: [super::super::Foundation::CHAR; 48],
}
#[cfg(feature = "Win32_Foundation")]
impl ACMFILTERTAGDETAILSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for ACMFILTERTAGDETAILSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for ACMFILTERTAGDETAILSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for ACMFILTERTAGDETAILSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for ACMFILTERTAGDETAILSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct ACMFILTERTAGDETAILSW {
pub cbStruct: u32,
pub dwFilterTagIndex: u32,
pub dwFilterTag: u32,
pub cbFilterSize: u32,
pub fdwSupport: u32,
pub cStandardFilters: u32,
pub szFilterTag: [u16; 48],
}
impl ACMFILTERTAGDETAILSW {}
impl ::core::default::Default for ACMFILTERTAGDETAILSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for ACMFILTERTAGDETAILSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for ACMFILTERTAGDETAILSW {}
unsafe impl ::windows::core::Abi for ACMFILTERTAGDETAILSW {
type Abi = Self;
}
pub const ACMFILTERTAGDETAILS_FILTERTAG_CHARS: u32 = 48u32;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFILTERTAGENUMCBA = unsafe extern "system" fn(hadid: HACMDRIVERID, paftd: *mut ACMFILTERTAGDETAILSA, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFILTERTAGENUMCBW = unsafe extern "system" fn(hadid: HACMDRIVERID, paftd: *mut ACMFILTERTAGDETAILSW, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[cfg(feature = "Win32_Foundation")]
impl ::core::clone::Clone for ACMFORMATCHOOSEA {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct ACMFORMATCHOOSEA {
pub cbStruct: u32,
pub fdwStyle: u32,
pub hwndOwner: super::super::Foundation::HWND,
pub pwfx: *mut WAVEFORMATEX,
pub cbwfx: u32,
pub pszTitle: super::super::Foundation::PSTR,
pub szFormatTag: [super::super::Foundation::CHAR; 48],
pub szFormat: [super::super::Foundation::CHAR; 128],
pub pszName: super::super::Foundation::PSTR,
pub cchName: u32,
pub fdwEnum: u32,
pub pwfxEnum: *mut WAVEFORMATEX,
pub hInstance: super::super::Foundation::HINSTANCE,
pub pszTemplateName: super::super::Foundation::PSTR,
pub lCustData: super::super::Foundation::LPARAM,
pub pfnHook: ::core::option::Option<ACMFORMATCHOOSEHOOKPROCA>,
}
#[cfg(feature = "Win32_Foundation")]
impl ACMFORMATCHOOSEA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for ACMFORMATCHOOSEA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for ACMFORMATCHOOSEA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for ACMFORMATCHOOSEA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for ACMFORMATCHOOSEA {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[cfg(feature = "Win32_Foundation")]
pub type ACMFORMATCHOOSEHOOKPROCA = unsafe extern "system" fn(hwnd: super::super::Foundation::HWND, umsg: u32, wparam: super::super::Foundation::WPARAM, lparam: super::super::Foundation::LPARAM) -> u32;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFORMATCHOOSEHOOKPROCW = unsafe extern "system" fn(hwnd: super::super::Foundation::HWND, umsg: u32, wparam: super::super::Foundation::WPARAM, lparam: super::super::Foundation::LPARAM) -> u32;
#[cfg(feature = "Win32_Foundation")]
impl ::core::clone::Clone for ACMFORMATCHOOSEW {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct ACMFORMATCHOOSEW {
pub cbStruct: u32,
pub fdwStyle: u32,
pub hwndOwner: super::super::Foundation::HWND,
pub pwfx: *mut WAVEFORMATEX,
pub cbwfx: u32,
pub pszTitle: super::super::Foundation::PWSTR,
pub szFormatTag: [u16; 48],
pub szFormat: [u16; 128],
pub pszName: super::super::Foundation::PWSTR,
pub cchName: u32,
pub fdwEnum: u32,
pub pwfxEnum: *mut WAVEFORMATEX,
pub hInstance: super::super::Foundation::HINSTANCE,
pub pszTemplateName: super::super::Foundation::PWSTR,
pub lCustData: super::super::Foundation::LPARAM,
pub pfnHook: ::core::option::Option<ACMFORMATCHOOSEHOOKPROCW>,
}
#[cfg(feature = "Win32_Foundation")]
impl ACMFORMATCHOOSEW {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for ACMFORMATCHOOSEW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for ACMFORMATCHOOSEW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for ACMFORMATCHOOSEW {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for ACMFORMATCHOOSEW {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
pub const ACMFORMATCHOOSE_STYLEF_CONTEXTHELP: i32 = 128i32;
pub const ACMFORMATCHOOSE_STYLEF_ENABLEHOOK: i32 = 8i32;
pub const ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE: i32 = 16i32;
pub const ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE: i32 = 32i32;
pub const ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT: i32 = 64i32;
pub const ACMFORMATCHOOSE_STYLEF_SHOWHELP: i32 = 4i32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct ACMFORMATDETAILSA {
pub cbStruct: u32,
pub dwFormatIndex: u32,
pub dwFormatTag: u32,
pub fdwSupport: u32,
pub pwfx: *mut WAVEFORMATEX,
pub cbwfx: u32,
pub szFormat: [super::super::Foundation::CHAR; 128],
}
#[cfg(feature = "Win32_Foundation")]
impl ACMFORMATDETAILSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for ACMFORMATDETAILSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for ACMFORMATDETAILSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for ACMFORMATDETAILSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for ACMFORMATDETAILSA {
type Abi = Self;
}
pub const ACMFORMATDETAILS_FORMAT_CHARS: u32 = 128u32;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFORMATENUMCBA = unsafe extern "system" fn(hadid: HACMDRIVERID, pafd: *mut ACMFORMATDETAILSA, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFORMATENUMCBW = unsafe extern "system" fn(hadid: HACMDRIVERID, pafd: *mut tACMFORMATDETAILSW, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct ACMFORMATTAGDETAILSA {
pub cbStruct: u32,
pub dwFormatTagIndex: u32,
pub dwFormatTag: u32,
pub cbFormatSize: u32,
pub fdwSupport: u32,
pub cStandardFormats: u32,
pub szFormatTag: [super::super::Foundation::CHAR; 48],
}
#[cfg(feature = "Win32_Foundation")]
impl ACMFORMATTAGDETAILSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for ACMFORMATTAGDETAILSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for ACMFORMATTAGDETAILSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for ACMFORMATTAGDETAILSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for ACMFORMATTAGDETAILSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct ACMFORMATTAGDETAILSW {
pub cbStruct: u32,
pub dwFormatTagIndex: u32,
pub dwFormatTag: u32,
pub cbFormatSize: u32,
pub fdwSupport: u32,
pub cStandardFormats: u32,
pub szFormatTag: [u16; 48],
}
impl ACMFORMATTAGDETAILSW {}
impl ::core::default::Default for ACMFORMATTAGDETAILSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for ACMFORMATTAGDETAILSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for ACMFORMATTAGDETAILSW {}
unsafe impl ::windows::core::Abi for ACMFORMATTAGDETAILSW {
type Abi = Self;
}
pub const ACMFORMATTAGDETAILS_FORMATTAG_CHARS: u32 = 48u32;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFORMATTAGENUMCBA = unsafe extern "system" fn(hadid: HACMDRIVERID, paftd: *mut ACMFORMATTAGDETAILSA, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[cfg(feature = "Win32_Foundation")]
pub type ACMFORMATTAGENUMCBW = unsafe extern "system" fn(hadid: HACMDRIVERID, paftd: *mut ACMFORMATTAGDETAILSW, dwinstance: usize, fdwsupport: u32) -> super::super::Foundation::BOOL;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))]
pub struct ACMSTREAMHEADER {
pub cbStruct: u32,
pub fdwStatus: u32,
pub dwUser: usize,
pub pbSrc: *mut u8,
pub cbSrcLength: u32,
pub cbSrcLengthUsed: u32,
pub dwSrcUser: usize,
pub pbDst: *mut u8,
pub cbDstLength: u32,
pub cbDstLengthUsed: u32,
pub dwDstUser: usize,
pub dwReservedDriver: [u32; 15],
}
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))]
impl ACMSTREAMHEADER {}
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))]
impl ::core::default::Default for ACMSTREAMHEADER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))]
impl ::core::cmp::PartialEq for ACMSTREAMHEADER {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))]
impl ::core::cmp::Eq for ACMSTREAMHEADER {}
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))]
unsafe impl ::windows::core::Abi for ACMSTREAMHEADER {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(any(target_arch = "x86",))]
pub struct ACMSTREAMHEADER {
pub cbStruct: u32,
pub fdwStatus: u32,
pub dwUser: usize,
pub pbSrc: *mut u8,
pub cbSrcLength: u32,
pub cbSrcLengthUsed: u32,
pub dwSrcUser: usize,
pub pbDst: *mut u8,
pub cbDstLength: u32,
pub cbDstLengthUsed: u32,
pub dwDstUser: usize,
pub dwReservedDriver: [u32; 10],
}
#[cfg(any(target_arch = "x86",))]
impl ACMSTREAMHEADER {}
#[cfg(any(target_arch = "x86",))]
impl ::core::default::Default for ACMSTREAMHEADER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(any(target_arch = "x86",))]
impl ::core::cmp::PartialEq for ACMSTREAMHEADER {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(any(target_arch = "x86",))]
impl ::core::cmp::Eq for ACMSTREAMHEADER {}
#[cfg(any(target_arch = "x86",))]
unsafe impl ::windows::core::Abi for ACMSTREAMHEADER {
type Abi = Self;
}
pub const ACMSTREAMHEADER_STATUSF_DONE: i32 = 65536i32;
pub const ACMSTREAMHEADER_STATUSF_INQUEUE: i32 = 1048576i32;
pub const ACMSTREAMHEADER_STATUSF_PREPARED: i32 = 131072i32;
pub const ACM_DRIVERADDF_FUNCTION: i32 = 3i32;
pub const ACM_DRIVERADDF_GLOBAL: i32 = 8i32;
pub const ACM_DRIVERADDF_LOCAL: i32 = 0i32;
pub const ACM_DRIVERADDF_NAME: i32 = 1i32;
pub const ACM_DRIVERADDF_NOTIFYHWND: i32 = 4i32;
pub const ACM_DRIVERADDF_TYPEMASK: i32 = 7i32;
pub const ACM_DRIVERENUMF_DISABLED: i32 = -2147483648i32;
pub const ACM_DRIVERENUMF_NOLOCAL: i32 = 1073741824i32;
pub const ACM_DRIVERPRIORITYF_ABLEMASK: i32 = 3i32;
pub const ACM_DRIVERPRIORITYF_BEGIN: i32 = 65536i32;
pub const ACM_DRIVERPRIORITYF_DEFERMASK: i32 = 196608i32;
pub const ACM_DRIVERPRIORITYF_DISABLE: i32 = 2i32;
pub const ACM_DRIVERPRIORITYF_ENABLE: i32 = 1i32;
pub const ACM_DRIVERPRIORITYF_END: i32 = 131072i32;
pub const ACM_FILTERDETAILSF_FILTER: i32 = 1i32;
pub const ACM_FILTERDETAILSF_INDEX: i32 = 0i32;
pub const ACM_FILTERDETAILSF_QUERYMASK: i32 = 15i32;
pub const ACM_FILTERENUMF_DWFILTERTAG: i32 = 65536i32;
pub const ACM_FILTERTAGDETAILSF_FILTERTAG: i32 = 1i32;
pub const ACM_FILTERTAGDETAILSF_INDEX: i32 = 0i32;
pub const ACM_FILTERTAGDETAILSF_LARGESTSIZE: i32 = 2i32;
pub const ACM_FILTERTAGDETAILSF_QUERYMASK: i32 = 15i32;
pub const ACM_FORMATDETAILSF_FORMAT: i32 = 1i32;
pub const ACM_FORMATDETAILSF_INDEX: i32 = 0i32;
pub const ACM_FORMATDETAILSF_QUERYMASK: i32 = 15i32;
pub const ACM_FORMATENUMF_CONVERT: i32 = 1048576i32;
pub const ACM_FORMATENUMF_HARDWARE: i32 = 4194304i32;
pub const ACM_FORMATENUMF_INPUT: i32 = 8388608i32;
pub const ACM_FORMATENUMF_NCHANNELS: i32 = 131072i32;
pub const ACM_FORMATENUMF_NSAMPLESPERSEC: i32 = 262144i32;
pub const ACM_FORMATENUMF_OUTPUT: i32 = 16777216i32;
pub const ACM_FORMATENUMF_SUGGEST: i32 = 2097152i32;
pub const ACM_FORMATENUMF_WBITSPERSAMPLE: i32 = 524288i32;
pub const ACM_FORMATENUMF_WFORMATTAG: i32 = 65536i32;
pub const ACM_FORMATSUGGESTF_NCHANNELS: i32 = 131072i32;
pub const ACM_FORMATSUGGESTF_NSAMPLESPERSEC: i32 = 262144i32;
pub const ACM_FORMATSUGGESTF_TYPEMASK: i32 = 16711680i32;
pub const ACM_FORMATSUGGESTF_WBITSPERSAMPLE: i32 = 524288i32;
pub const ACM_FORMATSUGGESTF_WFORMATTAG: i32 = 65536i32;
pub const ACM_FORMATTAGDETAILSF_FORMATTAG: i32 = 1i32;
pub const ACM_FORMATTAGDETAILSF_INDEX: i32 = 0i32;
pub const ACM_FORMATTAGDETAILSF_LARGESTSIZE: i32 = 2i32;
pub const ACM_FORMATTAGDETAILSF_QUERYMASK: i32 = 15i32;
pub const ACM_METRIC_COUNT_CODECS: u32 = 2u32;
pub const ACM_METRIC_COUNT_CONVERTERS: u32 = 3u32;
pub const ACM_METRIC_COUNT_DISABLED: u32 = 5u32;
pub const ACM_METRIC_COUNT_DRIVERS: u32 = 1u32;
pub const ACM_METRIC_COUNT_FILTERS: u32 = 4u32;
pub const ACM_METRIC_COUNT_HARDWARE: u32 = 6u32;
pub const ACM_METRIC_COUNT_LOCAL_CODECS: u32 = 21u32;
pub const ACM_METRIC_COUNT_LOCAL_CONVERTERS: u32 = 22u32;
pub const ACM_METRIC_COUNT_LOCAL_DISABLED: u32 = 24u32;
pub const ACM_METRIC_COUNT_LOCAL_DRIVERS: u32 = 20u32;
pub const ACM_METRIC_COUNT_LOCAL_FILTERS: u32 = 23u32;
pub const ACM_METRIC_DRIVER_PRIORITY: u32 = 101u32;
pub const ACM_METRIC_DRIVER_SUPPORT: u32 = 100u32;
pub const ACM_METRIC_HARDWARE_WAVE_INPUT: u32 = 30u32;
pub const ACM_METRIC_HARDWARE_WAVE_OUTPUT: u32 = 31u32;
pub const ACM_METRIC_MAX_SIZE_FILTER: u32 = 51u32;
pub const ACM_METRIC_MAX_SIZE_FORMAT: u32 = 50u32;
pub const ACM_STREAMCONVERTF_BLOCKALIGN: u32 = 4u32;
pub const ACM_STREAMCONVERTF_END: u32 = 32u32;
pub const ACM_STREAMCONVERTF_START: u32 = 16u32;
pub const ACM_STREAMOPENF_ASYNC: u32 = 2u32;
pub const ACM_STREAMOPENF_NONREALTIME: u32 = 4u32;
pub const ACM_STREAMOPENF_QUERY: u32 = 1u32;
pub const ACM_STREAMSIZEF_DESTINATION: i32 = 1i32;
pub const ACM_STREAMSIZEF_QUERYMASK: i32 = 15i32;
pub const ACM_STREAMSIZEF_SOURCE: i32 = 0i32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AMBISONICS_CHANNEL_ORDERING(pub i32);
pub const AMBISONICS_CHANNEL_ORDERING_ACN: AMBISONICS_CHANNEL_ORDERING = AMBISONICS_CHANNEL_ORDERING(0i32);
impl ::core::convert::From<i32> for AMBISONICS_CHANNEL_ORDERING {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AMBISONICS_CHANNEL_ORDERING {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AMBISONICS_NORMALIZATION(pub i32);
pub const AMBISONICS_NORMALIZATION_SN3D: AMBISONICS_NORMALIZATION = AMBISONICS_NORMALIZATION(0i32);
pub const AMBISONICS_NORMALIZATION_N3D: AMBISONICS_NORMALIZATION = AMBISONICS_NORMALIZATION(1i32);
impl ::core::convert::From<i32> for AMBISONICS_NORMALIZATION {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AMBISONICS_NORMALIZATION {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct AMBISONICS_PARAMS {
pub u32Size: u32,
pub u32Version: u32,
pub u32Type: AMBISONICS_TYPE,
pub u32ChannelOrdering: AMBISONICS_CHANNEL_ORDERING,
pub u32Normalization: AMBISONICS_NORMALIZATION,
pub u32Order: u32,
pub u32NumChannels: u32,
pub pu32ChannelMap: *mut u32,
}
impl AMBISONICS_PARAMS {}
impl ::core::default::Default for AMBISONICS_PARAMS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for AMBISONICS_PARAMS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AMBISONICS_PARAMS")
.field("u32Size", &self.u32Size)
.field("u32Version", &self.u32Version)
.field("u32Type", &self.u32Type)
.field("u32ChannelOrdering", &self.u32ChannelOrdering)
.field("u32Normalization", &self.u32Normalization)
.field("u32Order", &self.u32Order)
.field("u32NumChannels", &self.u32NumChannels)
.field("pu32ChannelMap", &self.pu32ChannelMap)
.finish()
}
}
impl ::core::cmp::PartialEq for AMBISONICS_PARAMS {
fn eq(&self, other: &Self) -> bool {
self.u32Size == other.u32Size && self.u32Version == other.u32Version && self.u32Type == other.u32Type && self.u32ChannelOrdering == other.u32ChannelOrdering && self.u32Normalization == other.u32Normalization && self.u32Order == other.u32Order && self.u32NumChannels == other.u32NumChannels && self.pu32ChannelMap == other.pu32ChannelMap
}
}
impl ::core::cmp::Eq for AMBISONICS_PARAMS {}
unsafe impl ::windows::core::Abi for AMBISONICS_PARAMS {
type Abi = Self;
}
pub const AMBISONICS_PARAM_VERSION_1: u32 = 1u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AMBISONICS_TYPE(pub i32);
pub const AMBISONICS_TYPE_FULL3D: AMBISONICS_TYPE = AMBISONICS_TYPE(0i32);
impl ::core::convert::From<i32> for AMBISONICS_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AMBISONICS_TYPE {
type Abi = Self;
}
pub const AUDCLNT_E_ALREADY_INITIALIZED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287486i32 as _);
pub const AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287469i32 as _);
pub const AUDCLNT_E_BUFFER_ERROR: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287464i32 as _);
pub const AUDCLNT_E_BUFFER_OPERATION_PENDING: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287477i32 as _);
pub const AUDCLNT_E_BUFFER_SIZE_ERROR: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287466i32 as _);
pub const AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287463i32 as _);
pub const AUDCLNT_E_BUFFER_TOO_LARGE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287482i32 as _);
pub const AUDCLNT_E_CPUUSAGE_EXCEEDED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287465i32 as _);
pub const AUDCLNT_E_DEVICE_INVALIDATED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287484i32 as _);
pub const AUDCLNT_E_DEVICE_IN_USE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287478i32 as _);
pub const AUDCLNT_E_EFFECT_NOT_AVAILABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287423i32 as _);
pub const AUDCLNT_E_EFFECT_STATE_READ_ONLY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287422i32 as _);
pub const AUDCLNT_E_ENDPOINT_CREATE_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287473i32 as _);
pub const AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287454i32 as _);
pub const AUDCLNT_E_ENGINE_FORMAT_LOCKED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287447i32 as _);
pub const AUDCLNT_E_ENGINE_PERIODICITY_LOCKED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287448i32 as _);
pub const AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287471i32 as _);
pub const AUDCLNT_E_EVENTHANDLE_NOT_SET: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287468i32 as _);
pub const AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287474i32 as _);
pub const AUDCLNT_E_EXCLUSIVE_MODE_ONLY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287470i32 as _);
pub const AUDCLNT_E_HEADTRACKING_ENABLED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287440i32 as _);
pub const AUDCLNT_E_HEADTRACKING_UNSUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287424i32 as _);
pub const AUDCLNT_E_INCORRECT_BUFFER_SIZE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287467i32 as _);
pub const AUDCLNT_E_INVALID_DEVICE_PERIOD: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287456i32 as _);
pub const AUDCLNT_E_INVALID_SIZE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287479i32 as _);
pub const AUDCLNT_E_INVALID_STREAM_FLAG: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287455i32 as _);
pub const AUDCLNT_E_NONOFFLOAD_MODE_ONLY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287451i32 as _);
pub const AUDCLNT_E_NOT_INITIALIZED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287487i32 as _);
pub const AUDCLNT_E_NOT_STOPPED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287483i32 as _);
pub const AUDCLNT_E_OFFLOAD_MODE_ONLY: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287452i32 as _);
pub const AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287453i32 as _);
pub const AUDCLNT_E_OUT_OF_ORDER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287481i32 as _);
pub const AUDCLNT_E_RAW_MODE_UNSUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287449i32 as _);
pub const AUDCLNT_E_RESOURCES_INVALIDATED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287450i32 as _);
pub const AUDCLNT_E_SERVICE_NOT_RUNNING: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287472i32 as _);
pub const AUDCLNT_E_THREAD_NOT_REGISTERED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287476i32 as _);
pub const AUDCLNT_E_UNSUPPORTED_FORMAT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287480i32 as _);
pub const AUDCLNT_E_WRONG_ENDPOINT_TYPE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287485i32 as _);
pub const AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE: u32 = 536870912u32;
pub const AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED: u32 = 1073741824u32;
pub const AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED: u32 = 268435456u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AUDCLNT_SHAREMODE(pub i32);
pub const AUDCLNT_SHAREMODE_SHARED: AUDCLNT_SHAREMODE = AUDCLNT_SHAREMODE(0i32);
pub const AUDCLNT_SHAREMODE_EXCLUSIVE: AUDCLNT_SHAREMODE = AUDCLNT_SHAREMODE(1i32);
impl ::core::convert::From<i32> for AUDCLNT_SHAREMODE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AUDCLNT_SHAREMODE {
type Abi = Self;
}
pub const AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM: u32 = 2147483648u32;
pub const AUDCLNT_STREAMFLAGS_CROSSPROCESS: u32 = 65536u32;
pub const AUDCLNT_STREAMFLAGS_EVENTCALLBACK: u32 = 262144u32;
pub const AUDCLNT_STREAMFLAGS_LOOPBACK: u32 = 131072u32;
pub const AUDCLNT_STREAMFLAGS_NOPERSIST: u32 = 524288u32;
pub const AUDCLNT_STREAMFLAGS_RATEADJUST: u32 = 1048576u32;
pub const AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY: u32 = 134217728u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AUDCLNT_STREAMOPTIONS(pub u32);
pub const AUDCLNT_STREAMOPTIONS_NONE: AUDCLNT_STREAMOPTIONS = AUDCLNT_STREAMOPTIONS(0u32);
pub const AUDCLNT_STREAMOPTIONS_RAW: AUDCLNT_STREAMOPTIONS = AUDCLNT_STREAMOPTIONS(1u32);
pub const AUDCLNT_STREAMOPTIONS_MATCH_FORMAT: AUDCLNT_STREAMOPTIONS = AUDCLNT_STREAMOPTIONS(2u32);
pub const AUDCLNT_STREAMOPTIONS_AMBISONICS: AUDCLNT_STREAMOPTIONS = AUDCLNT_STREAMOPTIONS(4u32);
impl ::core::convert::From<u32> for AUDCLNT_STREAMOPTIONS {
fn from(value: u32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AUDCLNT_STREAMOPTIONS {
type Abi = Self;
}
impl ::core::ops::BitOr for AUDCLNT_STREAMOPTIONS {
type Output = Self;
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
}
impl ::core::ops::BitAnd for AUDCLNT_STREAMOPTIONS {
type Output = Self;
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
}
impl ::core::ops::BitOrAssign for AUDCLNT_STREAMOPTIONS {
fn bitor_assign(&mut self, rhs: Self) {
self.0.bitor_assign(rhs.0)
}
}
impl ::core::ops::BitAndAssign for AUDCLNT_STREAMOPTIONS {
fn bitand_assign(&mut self, rhs: Self) {
self.0.bitand_assign(rhs.0)
}
}
impl ::core::ops::Not for AUDCLNT_STREAMOPTIONS {
type Output = Self;
fn not(self) -> Self {
Self(self.0.not())
}
}
pub const AUDCLNT_S_BUFFER_EMPTY: ::windows::core::HRESULT = ::windows::core::HRESULT(143196161i32 as _);
pub const AUDCLNT_S_POSITION_STALLED: ::windows::core::HRESULT = ::windows::core::HRESULT(143196163i32 as _);
pub const AUDCLNT_S_THREAD_ALREADY_REGISTERED: ::windows::core::HRESULT = ::windows::core::HRESULT(143196162i32 as _);
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct AUDIOCLIENT_ACTIVATION_PARAMS {
pub ActivationType: AUDIOCLIENT_ACTIVATION_TYPE,
pub Anonymous: AUDIOCLIENT_ACTIVATION_PARAMS_0,
}
impl AUDIOCLIENT_ACTIVATION_PARAMS {}
impl ::core::default::Default for AUDIOCLIENT_ACTIVATION_PARAMS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for AUDIOCLIENT_ACTIVATION_PARAMS {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for AUDIOCLIENT_ACTIVATION_PARAMS {}
unsafe impl ::windows::core::Abi for AUDIOCLIENT_ACTIVATION_PARAMS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub union AUDIOCLIENT_ACTIVATION_PARAMS_0 {
pub ProcessLoopbackParams: AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS,
}
impl AUDIOCLIENT_ACTIVATION_PARAMS_0 {}
impl ::core::default::Default for AUDIOCLIENT_ACTIVATION_PARAMS_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for AUDIOCLIENT_ACTIVATION_PARAMS_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for AUDIOCLIENT_ACTIVATION_PARAMS_0 {}
unsafe impl ::windows::core::Abi for AUDIOCLIENT_ACTIVATION_PARAMS_0 {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AUDIOCLIENT_ACTIVATION_TYPE(pub i32);
pub const AUDIOCLIENT_ACTIVATION_TYPE_DEFAULT: AUDIOCLIENT_ACTIVATION_TYPE = AUDIOCLIENT_ACTIVATION_TYPE(0i32);
pub const AUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACK: AUDIOCLIENT_ACTIVATION_TYPE = AUDIOCLIENT_ACTIVATION_TYPE(1i32);
impl ::core::convert::From<i32> for AUDIOCLIENT_ACTIVATION_TYPE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AUDIOCLIENT_ACTIVATION_TYPE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS {
pub TargetProcessId: u32,
pub ProcessLoopbackMode: PROCESS_LOOPBACK_MODE,
}
impl AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS {}
impl ::core::default::Default for AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS").field("TargetProcessId", &self.TargetProcessId).field("ProcessLoopbackMode", &self.ProcessLoopbackMode).finish()
}
}
impl ::core::cmp::PartialEq for AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS {
fn eq(&self, other: &Self) -> bool {
self.TargetProcessId == other.TargetProcessId && self.ProcessLoopbackMode == other.ProcessLoopbackMode
}
}
impl ::core::cmp::Eq for AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS {}
unsafe impl ::windows::core::Abi for AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS {
type Abi = Self;
}
pub const AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ: u32 = 1u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AUDIO_DUCKING_OPTIONS(pub u32);
pub const AUDIO_DUCKING_OPTIONS_DEFAULT: AUDIO_DUCKING_OPTIONS = AUDIO_DUCKING_OPTIONS(0u32);
pub const AUDIO_DUCKING_OPTIONS_DO_NOT_DUCK_OTHER_STREAMS: AUDIO_DUCKING_OPTIONS = AUDIO_DUCKING_OPTIONS(1u32);
impl ::core::convert::From<u32> for AUDIO_DUCKING_OPTIONS {
fn from(value: u32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AUDIO_DUCKING_OPTIONS {
type Abi = Self;
}
impl ::core::ops::BitOr for AUDIO_DUCKING_OPTIONS {
type Output = Self;
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
}
impl ::core::ops::BitAnd for AUDIO_DUCKING_OPTIONS {
type Output = Self;
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
}
impl ::core::ops::BitOrAssign for AUDIO_DUCKING_OPTIONS {
fn bitor_assign(&mut self, rhs: Self) {
self.0.bitor_assign(rhs.0)
}
}
impl ::core::ops::BitAndAssign for AUDIO_DUCKING_OPTIONS {
fn bitand_assign(&mut self, rhs: Self) {
self.0.bitand_assign(rhs.0)
}
}
impl ::core::ops::Not for AUDIO_DUCKING_OPTIONS {
type Output = Self;
fn not(self) -> Self {
Self(self.0.not())
}
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct AUDIO_EFFECT {
pub id: ::windows::core::GUID,
pub canSetState: super::super::Foundation::BOOL,
pub state: AUDIO_EFFECT_STATE,
}
#[cfg(feature = "Win32_Foundation")]
impl AUDIO_EFFECT {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for AUDIO_EFFECT {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for AUDIO_EFFECT {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AUDIO_EFFECT").field("id", &self.id).field("canSetState", &self.canSetState).field("state", &self.state).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for AUDIO_EFFECT {
fn eq(&self, other: &Self) -> bool {
self.id == other.id && self.canSetState == other.canSetState && self.state == other.state
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for AUDIO_EFFECT {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for AUDIO_EFFECT {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AUDIO_EFFECT_STATE(pub i32);
pub const AUDIO_EFFECT_STATE_OFF: AUDIO_EFFECT_STATE = AUDIO_EFFECT_STATE(0i32);
pub const AUDIO_EFFECT_STATE_ON: AUDIO_EFFECT_STATE = AUDIO_EFFECT_STATE(1i32);
impl ::core::convert::From<i32> for AUDIO_EFFECT_STATE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AUDIO_EFFECT_STATE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AUDIO_STREAM_CATEGORY(pub i32);
pub const AudioCategory_Other: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(0i32);
pub const AudioCategory_ForegroundOnlyMedia: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(1i32);
pub const AudioCategory_Communications: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(3i32);
pub const AudioCategory_Alerts: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(4i32);
pub const AudioCategory_SoundEffects: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(5i32);
pub const AudioCategory_GameEffects: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(6i32);
pub const AudioCategory_GameMedia: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(7i32);
pub const AudioCategory_GameChat: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(8i32);
pub const AudioCategory_Speech: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(9i32);
pub const AudioCategory_Movie: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(10i32);
pub const AudioCategory_Media: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(11i32);
pub const AudioCategory_FarFieldSpeech: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(12i32);
pub const AudioCategory_UniformSpeech: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(13i32);
pub const AudioCategory_VoiceTyping: AUDIO_STREAM_CATEGORY = AUDIO_STREAM_CATEGORY(14i32);
impl ::core::convert::From<i32> for AUDIO_STREAM_CATEGORY {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AUDIO_STREAM_CATEGORY {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct AUDIO_VOLUME_NOTIFICATION_DATA {
pub guidEventContext: ::windows::core::GUID,
pub bMuted: super::super::Foundation::BOOL,
pub fMasterVolume: f32,
pub nChannels: u32,
pub afChannelVolumes: [f32; 1],
}
#[cfg(feature = "Win32_Foundation")]
impl AUDIO_VOLUME_NOTIFICATION_DATA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for AUDIO_VOLUME_NOTIFICATION_DATA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for AUDIO_VOLUME_NOTIFICATION_DATA {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AUDIO_VOLUME_NOTIFICATION_DATA").field("guidEventContext", &self.guidEventContext).field("bMuted", &self.bMuted).field("fMasterVolume", &self.fMasterVolume).field("nChannels", &self.nChannels).field("afChannelVolumes", &self.afChannelVolumes).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for AUDIO_VOLUME_NOTIFICATION_DATA {
fn eq(&self, other: &Self) -> bool {
self.guidEventContext == other.guidEventContext && self.bMuted == other.bMuted && self.fMasterVolume == other.fMasterVolume && self.nChannels == other.nChannels && self.afChannelVolumes == other.afChannelVolumes
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for AUDIO_VOLUME_NOTIFICATION_DATA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for AUDIO_VOLUME_NOTIFICATION_DATA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct AUXCAPS2A {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub wTechnology: u16,
pub wReserved1: u16,
pub dwSupport: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
#[cfg(feature = "Win32_Foundation")]
impl AUXCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for AUXCAPS2A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for AUXCAPS2A {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for AUXCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for AUXCAPS2A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct AUXCAPS2W {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub wTechnology: u16,
pub wReserved1: u16,
pub dwSupport: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
impl AUXCAPS2W {}
impl ::core::default::Default for AUXCAPS2W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for AUXCAPS2W {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for AUXCAPS2W {}
unsafe impl ::windows::core::Abi for AUXCAPS2W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct AUXCAPSA {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub wTechnology: u16,
pub wReserved1: u16,
pub dwSupport: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl AUXCAPSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for AUXCAPSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for AUXCAPSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for AUXCAPSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for AUXCAPSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct AUXCAPSW {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub wTechnology: u16,
pub wReserved1: u16,
pub dwSupport: u32,
}
impl AUXCAPSW {}
impl ::core::default::Default for AUXCAPSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for AUXCAPSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for AUXCAPSW {}
unsafe impl ::windows::core::Abi for AUXCAPSW {
type Abi = Self;
}
pub const AUXCAPS_AUXIN: u32 = 2u32;
pub const AUXCAPS_CDAUDIO: u32 = 1u32;
pub const AUXCAPS_LRVOLUME: u32 = 2u32;
pub const AUXCAPS_VOLUME: u32 = 1u32;
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
#[inline]
pub unsafe fn ActivateAudioInterfaceAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, IActivateAudioInterfaceCompletionHandler>>(deviceinterfacepath: Param0, riid: *const ::windows::core::GUID, activationparams: *const super::super::System::Com::StructuredStorage::PROPVARIANT, completionhandler: Param3) -> ::windows::core::Result<IActivateAudioInterfaceAsyncOperation> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn ActivateAudioInterfaceAsync(deviceinterfacepath: super::super::Foundation::PWSTR, riid: *const ::windows::core::GUID, activationparams: *const ::core::mem::ManuallyDrop<super::super::System::Com::StructuredStorage::PROPVARIANT>, completionhandler: ::windows::core::RawPtr, activationoperation: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IActivateAudioInterfaceAsyncOperation as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
ActivateAudioInterfaceAsync(deviceinterfacepath.into_param().abi(), ::core::mem::transmute(riid), ::core::mem::transmute(activationparams), completionhandler.into_param().abi(), &mut result__).from_abi::<IActivateAudioInterfaceAsyncOperation>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct AudioClient3ActivationParams {
pub tracingContextId: ::windows::core::GUID,
}
impl AudioClient3ActivationParams {}
impl ::core::default::Default for AudioClient3ActivationParams {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for AudioClient3ActivationParams {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AudioClient3ActivationParams").field("tracingContextId", &self.tracingContextId).finish()
}
}
impl ::core::cmp::PartialEq for AudioClient3ActivationParams {
fn eq(&self, other: &Self) -> bool {
self.tracingContextId == other.tracingContextId
}
}
impl ::core::cmp::Eq for AudioClient3ActivationParams {}
unsafe impl ::windows::core::Abi for AudioClient3ActivationParams {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct AudioClientProperties {
pub cbSize: u32,
pub bIsOffload: super::super::Foundation::BOOL,
pub eCategory: AUDIO_STREAM_CATEGORY,
pub Options: AUDCLNT_STREAMOPTIONS,
}
#[cfg(feature = "Win32_Foundation")]
impl AudioClientProperties {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for AudioClientProperties {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for AudioClientProperties {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AudioClientProperties").field("cbSize", &self.cbSize).field("bIsOffload", &self.bIsOffload).field("eCategory", &self.eCategory).field("Options", &self.Options).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for AudioClientProperties {
fn eq(&self, other: &Self) -> bool {
self.cbSize == other.cbSize && self.bIsOffload == other.bIsOffload && self.eCategory == other.eCategory && self.Options == other.Options
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for AudioClientProperties {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for AudioClientProperties {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct AudioExtensionParams {
pub AddPageParam: super::super::Foundation::LPARAM,
pub pEndpoint: ::core::option::Option<IMMDevice>,
pub pPnpInterface: ::core::option::Option<IMMDevice>,
pub pPnpDevnode: ::core::option::Option<IMMDevice>,
}
#[cfg(feature = "Win32_Foundation")]
impl AudioExtensionParams {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for AudioExtensionParams {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::fmt::Debug for AudioExtensionParams {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("AudioExtensionParams").field("AddPageParam", &self.AddPageParam).field("pEndpoint", &self.pEndpoint).field("pPnpInterface", &self.pPnpInterface).field("pPnpDevnode", &self.pPnpDevnode).finish()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for AudioExtensionParams {
fn eq(&self, other: &Self) -> bool {
self.AddPageParam == other.AddPageParam && self.pEndpoint == other.pEndpoint && self.pPnpInterface == other.pPnpInterface && self.pPnpDevnode == other.pPnpDevnode
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for AudioExtensionParams {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for AudioExtensionParams {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AudioObjectType(pub u32);
pub const AudioObjectType_None: AudioObjectType = AudioObjectType(0u32);
pub const AudioObjectType_Dynamic: AudioObjectType = AudioObjectType(1u32);
pub const AudioObjectType_FrontLeft: AudioObjectType = AudioObjectType(2u32);
pub const AudioObjectType_FrontRight: AudioObjectType = AudioObjectType(4u32);
pub const AudioObjectType_FrontCenter: AudioObjectType = AudioObjectType(8u32);
pub const AudioObjectType_LowFrequency: AudioObjectType = AudioObjectType(16u32);
pub const AudioObjectType_SideLeft: AudioObjectType = AudioObjectType(32u32);
pub const AudioObjectType_SideRight: AudioObjectType = AudioObjectType(64u32);
pub const AudioObjectType_BackLeft: AudioObjectType = AudioObjectType(128u32);
pub const AudioObjectType_BackRight: AudioObjectType = AudioObjectType(256u32);
pub const AudioObjectType_TopFrontLeft: AudioObjectType = AudioObjectType(512u32);
pub const AudioObjectType_TopFrontRight: AudioObjectType = AudioObjectType(1024u32);
pub const AudioObjectType_TopBackLeft: AudioObjectType = AudioObjectType(2048u32);
pub const AudioObjectType_TopBackRight: AudioObjectType = AudioObjectType(4096u32);
pub const AudioObjectType_BottomFrontLeft: AudioObjectType = AudioObjectType(8192u32);
pub const AudioObjectType_BottomFrontRight: AudioObjectType = AudioObjectType(16384u32);
pub const AudioObjectType_BottomBackLeft: AudioObjectType = AudioObjectType(32768u32);
pub const AudioObjectType_BottomBackRight: AudioObjectType = AudioObjectType(65536u32);
pub const AudioObjectType_BackCenter: AudioObjectType = AudioObjectType(131072u32);
impl ::core::convert::From<u32> for AudioObjectType {
fn from(value: u32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AudioObjectType {
type Abi = Self;
}
impl ::core::ops::BitOr for AudioObjectType {
type Output = Self;
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
}
impl ::core::ops::BitAnd for AudioObjectType {
type Output = Self;
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
}
impl ::core::ops::BitOrAssign for AudioObjectType {
fn bitor_assign(&mut self, rhs: Self) {
self.0.bitor_assign(rhs.0)
}
}
impl ::core::ops::BitAndAssign for AudioObjectType {
fn bitand_assign(&mut self, rhs: Self) {
self.0.bitand_assign(rhs.0)
}
}
impl ::core::ops::Not for AudioObjectType {
type Output = Self;
fn not(self) -> Self {
Self(self.0.not())
}
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AudioSessionDisconnectReason(pub i32);
pub const DisconnectReasonDeviceRemoval: AudioSessionDisconnectReason = AudioSessionDisconnectReason(0i32);
pub const DisconnectReasonServerShutdown: AudioSessionDisconnectReason = AudioSessionDisconnectReason(1i32);
pub const DisconnectReasonFormatChanged: AudioSessionDisconnectReason = AudioSessionDisconnectReason(2i32);
pub const DisconnectReasonSessionLogoff: AudioSessionDisconnectReason = AudioSessionDisconnectReason(3i32);
pub const DisconnectReasonSessionDisconnected: AudioSessionDisconnectReason = AudioSessionDisconnectReason(4i32);
pub const DisconnectReasonExclusiveModeOverride: AudioSessionDisconnectReason = AudioSessionDisconnectReason(5i32);
impl ::core::convert::From<i32> for AudioSessionDisconnectReason {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AudioSessionDisconnectReason {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AudioSessionState(pub i32);
pub const AudioSessionStateInactive: AudioSessionState = AudioSessionState(0i32);
pub const AudioSessionStateActive: AudioSessionState = AudioSessionState(1i32);
pub const AudioSessionStateExpired: AudioSessionState = AudioSessionState(2i32);
impl ::core::convert::From<i32> for AudioSessionState {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AudioSessionState {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct AudioStateMonitorSoundLevel(pub i32);
pub const Muted: AudioStateMonitorSoundLevel = AudioStateMonitorSoundLevel(0i32);
pub const Low: AudioStateMonitorSoundLevel = AudioStateMonitorSoundLevel(1i32);
pub const Full: AudioStateMonitorSoundLevel = AudioStateMonitorSoundLevel(2i32);
impl ::core::convert::From<i32> for AudioStateMonitorSoundLevel {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for AudioStateMonitorSoundLevel {
type Abi = Self;
}
#[inline]
pub unsafe fn CoRegisterMessageFilter<'a, Param0: ::windows::core::IntoParam<'a, IMessageFilter>>(lpmessagefilter: Param0) -> ::windows::core::Result<IMessageFilter> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CoRegisterMessageFilter(lpmessagefilter: ::windows::core::RawPtr, lplpmessagefilter: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IMessageFilter as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CoRegisterMessageFilter(lpmessagefilter.into_param().abi(), &mut result__).from_abi::<IMessageFilter>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct ConnectorType(pub i32);
impl ConnectorType {
pub const Unknown_Connector: ConnectorType = ConnectorType(0i32);
pub const Physical_Internal: ConnectorType = ConnectorType(1i32);
pub const Physical_External: ConnectorType = ConnectorType(2i32);
pub const Software_IO: ConnectorType = ConnectorType(3i32);
pub const Software_Fixed: ConnectorType = ConnectorType(4i32);
pub const Network: ConnectorType = ConnectorType(5i32);
}
impl ::core::convert::From<i32> for ConnectorType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for ConnectorType {
type Abi = Self;
}
#[inline]
pub unsafe fn CreateCaptureAudioStateMonitor() -> ::windows::core::Result<IAudioStateMonitor> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CreateCaptureAudioStateMonitor(audiostatemonitor: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IAudioStateMonitor as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CreateCaptureAudioStateMonitor(&mut result__).from_abi::<IAudioStateMonitor>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn CreateCaptureAudioStateMonitorForCategory(category: AUDIO_STREAM_CATEGORY) -> ::windows::core::Result<IAudioStateMonitor> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CreateCaptureAudioStateMonitorForCategory(category: AUDIO_STREAM_CATEGORY, audiostatemonitor: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IAudioStateMonitor as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CreateCaptureAudioStateMonitorForCategory(::core::mem::transmute(category), &mut result__).from_abi::<IAudioStateMonitor>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn CreateCaptureAudioStateMonitorForCategoryAndDeviceId<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(category: AUDIO_STREAM_CATEGORY, deviceid: Param1) -> ::windows::core::Result<IAudioStateMonitor> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CreateCaptureAudioStateMonitorForCategoryAndDeviceId(category: AUDIO_STREAM_CATEGORY, deviceid: super::super::Foundation::PWSTR, audiostatemonitor: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IAudioStateMonitor as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CreateCaptureAudioStateMonitorForCategoryAndDeviceId(::core::mem::transmute(category), deviceid.into_param().abi(), &mut result__).from_abi::<IAudioStateMonitor>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(category: AUDIO_STREAM_CATEGORY, role: ERole) -> ::windows::core::Result<IAudioStateMonitor> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(category: AUDIO_STREAM_CATEGORY, role: ERole, audiostatemonitor: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IAudioStateMonitor as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(::core::mem::transmute(category), ::core::mem::transmute(role), &mut result__).from_abi::<IAudioStateMonitor>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn CreateRenderAudioStateMonitor() -> ::windows::core::Result<IAudioStateMonitor> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CreateRenderAudioStateMonitor(audiostatemonitor: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IAudioStateMonitor as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CreateRenderAudioStateMonitor(&mut result__).from_abi::<IAudioStateMonitor>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn CreateRenderAudioStateMonitorForCategory(category: AUDIO_STREAM_CATEGORY) -> ::windows::core::Result<IAudioStateMonitor> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CreateRenderAudioStateMonitorForCategory(category: AUDIO_STREAM_CATEGORY, audiostatemonitor: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IAudioStateMonitor as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CreateRenderAudioStateMonitorForCategory(::core::mem::transmute(category), &mut result__).from_abi::<IAudioStateMonitor>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn CreateRenderAudioStateMonitorForCategoryAndDeviceId<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(category: AUDIO_STREAM_CATEGORY, deviceid: Param1) -> ::windows::core::Result<IAudioStateMonitor> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CreateRenderAudioStateMonitorForCategoryAndDeviceId(category: AUDIO_STREAM_CATEGORY, deviceid: super::super::Foundation::PWSTR, audiostatemonitor: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IAudioStateMonitor as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CreateRenderAudioStateMonitorForCategoryAndDeviceId(::core::mem::transmute(category), deviceid.into_param().abi(), &mut result__).from_abi::<IAudioStateMonitor>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn CreateRenderAudioStateMonitorForCategoryAndDeviceRole(category: AUDIO_STREAM_CATEGORY, role: ERole) -> ::windows::core::Result<IAudioStateMonitor> {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn CreateRenderAudioStateMonitorForCategoryAndDeviceRole(category: AUDIO_STREAM_CATEGORY, role: ERole, audiostatemonitor: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT;
}
let mut result__: <IAudioStateMonitor as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
CreateRenderAudioStateMonitorForCategoryAndDeviceRole(::core::mem::transmute(category), ::core::mem::transmute(role), &mut result__).from_abi::<IAudioStateMonitor>(result__)
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
pub const DEVICE_STATEMASK_ALL: u32 = 15u32;
pub const DEVICE_STATE_ACTIVE: u32 = 1u32;
pub const DEVICE_STATE_DISABLED: u32 = 2u32;
pub const DEVICE_STATE_NOTPRESENT: u32 = 4u32;
pub const DEVICE_STATE_UNPLUGGED: u32 = 8u32;
pub const DEVINTERFACE_AUDIO_CAPTURE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2eef81be_33fa_4800_9670_1cd474972c3f);
pub const DEVINTERFACE_AUDIO_RENDER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe6327cad_dcec_4949_ae8a_991e976a79d2);
pub const DEVINTERFACE_MIDI_INPUT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x504be32c_ccf6_4d2c_b73f_6f8b3747e22b);
pub const DEVINTERFACE_MIDI_OUTPUT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6dc23320_ab33_4ce4_80d4_bbb3ebbf2814);
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct DIRECTX_AUDIO_ACTIVATION_PARAMS {
pub cbDirectXAudioActivationParams: u32,
pub guidAudioSession: ::windows::core::GUID,
pub dwAudioStreamFlags: u32,
}
impl DIRECTX_AUDIO_ACTIVATION_PARAMS {}
impl ::core::default::Default for DIRECTX_AUDIO_ACTIVATION_PARAMS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for DIRECTX_AUDIO_ACTIVATION_PARAMS {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("DIRECTX_AUDIO_ACTIVATION_PARAMS").field("cbDirectXAudioActivationParams", &self.cbDirectXAudioActivationParams).field("guidAudioSession", &self.guidAudioSession).field("dwAudioStreamFlags", &self.dwAudioStreamFlags).finish()
}
}
impl ::core::cmp::PartialEq for DIRECTX_AUDIO_ACTIVATION_PARAMS {
fn eq(&self, other: &Self) -> bool {
self.cbDirectXAudioActivationParams == other.cbDirectXAudioActivationParams && self.guidAudioSession == other.guidAudioSession && self.dwAudioStreamFlags == other.dwAudioStreamFlags
}
}
impl ::core::cmp::Eq for DIRECTX_AUDIO_ACTIVATION_PARAMS {}
unsafe impl ::windows::core::Abi for DIRECTX_AUDIO_ACTIVATION_PARAMS {
type Abi = Self;
}
pub const DRVM_MAPPER: u32 = 8192u32;
pub const DRVM_MAPPER_STATUS: u32 = 8192u32;
pub const DRV_MAPPER_PREFERRED_INPUT_GET: u32 = 16384u32;
pub const DRV_MAPPER_PREFERRED_OUTPUT_GET: u32 = 16386u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct DataFlow(pub i32);
pub const In: DataFlow = DataFlow(0i32);
pub const Out: DataFlow = DataFlow(1i32);
impl ::core::convert::From<i32> for DataFlow {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for DataFlow {
type Abi = Self;
}
pub const DeviceTopology: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1df639d0_5ec1_47aa_9379_828dc1aa8c59);
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct ECHOWAVEFILTER {
pub wfltr: WAVEFILTER,
pub dwVolume: u32,
pub dwDelay: u32,
}
impl ECHOWAVEFILTER {}
impl ::core::default::Default for ECHOWAVEFILTER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for ECHOWAVEFILTER {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for ECHOWAVEFILTER {}
unsafe impl ::windows::core::Abi for ECHOWAVEFILTER {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct EDataFlow(pub i32);
pub const eRender: EDataFlow = EDataFlow(0i32);
pub const eCapture: EDataFlow = EDataFlow(1i32);
pub const eAll: EDataFlow = EDataFlow(2i32);
pub const EDataFlow_enum_count: EDataFlow = EDataFlow(3i32);
impl ::core::convert::From<i32> for EDataFlow {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for EDataFlow {
type Abi = Self;
}
pub const ENDPOINT_FORMAT_RESET_MIX_ONLY: u32 = 1u32;
pub const ENDPOINT_HARDWARE_SUPPORT_METER: u32 = 4u32;
pub const ENDPOINT_HARDWARE_SUPPORT_MUTE: u32 = 2u32;
pub const ENDPOINT_HARDWARE_SUPPORT_VOLUME: u32 = 1u32;
pub const ENDPOINT_SYSFX_DISABLED: u32 = 1u32;
pub const ENDPOINT_SYSFX_ENABLED: u32 = 0u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct ERole(pub i32);
pub const eConsole: ERole = ERole(0i32);
pub const eMultimedia: ERole = ERole(1i32);
pub const eCommunications: ERole = ERole(2i32);
pub const ERole_enum_count: ERole = ERole(3i32);
impl ::core::convert::From<i32> for ERole {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for ERole {
type Abi = Self;
}
pub const EVENTCONTEXT_VOLUMESLIDER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe2c2e9de_09b1_4b04_84e5_07931225ee04);
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct EndpointFormFactor(pub i32);
pub const RemoteNetworkDevice: EndpointFormFactor = EndpointFormFactor(0i32);
pub const Speakers: EndpointFormFactor = EndpointFormFactor(1i32);
pub const LineLevel: EndpointFormFactor = EndpointFormFactor(2i32);
pub const Headphones: EndpointFormFactor = EndpointFormFactor(3i32);
pub const Microphone: EndpointFormFactor = EndpointFormFactor(4i32);
pub const Headset: EndpointFormFactor = EndpointFormFactor(5i32);
pub const Handset: EndpointFormFactor = EndpointFormFactor(6i32);
pub const UnknownDigitalPassthrough: EndpointFormFactor = EndpointFormFactor(7i32);
pub const SPDIF: EndpointFormFactor = EndpointFormFactor(8i32);
pub const DigitalAudioDisplayDevice: EndpointFormFactor = EndpointFormFactor(9i32);
pub const UnknownFormFactor: EndpointFormFactor = EndpointFormFactor(10i32);
pub const EndpointFormFactor_enum_count: EndpointFormFactor = EndpointFormFactor(11i32);
impl ::core::convert::From<i32> for EndpointFormFactor {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for EndpointFormFactor {
type Abi = Self;
}
pub const FILTERCHOOSE_CUSTOM_VERIFY: u32 = 2u32;
pub const FILTERCHOOSE_FILTERTAG_VERIFY: u32 = 0u32;
pub const FILTERCHOOSE_FILTER_VERIFY: u32 = 1u32;
pub const FILTERCHOOSE_MESSAGE: u32 = 0u32;
pub const FORMATCHOOSE_CUSTOM_VERIFY: u32 = 2u32;
pub const FORMATCHOOSE_FORMATTAG_VERIFY: u32 = 0u32;
pub const FORMATCHOOSE_FORMAT_VERIFY: u32 = 1u32;
pub const FORMATCHOOSE_MESSAGE: u32 = 0u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HACMDRIVER(pub isize);
impl ::core::default::Default for HACMDRIVER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HACMDRIVER {}
unsafe impl ::windows::core::Abi for HACMDRIVER {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HACMDRIVERID(pub isize);
impl ::core::default::Default for HACMDRIVERID {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HACMDRIVERID {}
unsafe impl ::windows::core::Abi for HACMDRIVERID {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HACMOBJ(pub isize);
impl ::core::default::Default for HACMOBJ {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HACMOBJ {}
unsafe impl ::windows::core::Abi for HACMOBJ {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HACMSTREAM(pub isize);
impl ::core::default::Default for HACMSTREAM {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HACMSTREAM {}
unsafe impl ::windows::core::Abi for HACMSTREAM {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HMIDI(pub isize);
impl ::core::default::Default for HMIDI {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HMIDI {}
unsafe impl ::windows::core::Abi for HMIDI {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HMIDIIN(pub isize);
impl ::core::default::Default for HMIDIIN {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HMIDIIN {}
unsafe impl ::windows::core::Abi for HMIDIIN {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HMIDIOUT(pub isize);
impl ::core::default::Default for HMIDIOUT {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HMIDIOUT {}
unsafe impl ::windows::core::Abi for HMIDIOUT {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HMIDISTRM(pub isize);
impl ::core::default::Default for HMIDISTRM {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HMIDISTRM {}
unsafe impl ::windows::core::Abi for HMIDISTRM {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HMIXER(pub isize);
impl ::core::default::Default for HMIXER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HMIXER {}
unsafe impl ::windows::core::Abi for HMIXER {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HMIXEROBJ(pub isize);
impl ::core::default::Default for HMIXEROBJ {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HMIXEROBJ {}
unsafe impl ::windows::core::Abi for HMIXEROBJ {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HWAVE(pub isize);
impl ::core::default::Default for HWAVE {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HWAVE {}
unsafe impl ::windows::core::Abi for HWAVE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HWAVEIN(pub isize);
impl ::core::default::Default for HWAVEIN {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HWAVEIN {}
unsafe impl ::windows::core::Abi for HWAVEIN {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)]
#[repr(transparent)]
pub struct HWAVEOUT(pub isize);
impl ::core::default::Default for HWAVEOUT {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
unsafe impl ::windows::core::Handle for HWAVEOUT {}
unsafe impl ::windows::core::Abi for HWAVEOUT {
type Abi = Self;
}
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IActivateAudioInterfaceAsyncOperation(pub ::windows::core::IUnknown);
impl IActivateAudioInterfaceAsyncOperation {
pub unsafe fn GetActivateResult(&self, activateresult: *mut ::windows::core::HRESULT, activatedinterface: *mut ::core::option::Option<::windows::core::IUnknown>) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(activateresult), ::core::mem::transmute(activatedinterface)).ok()
}
}
unsafe impl ::windows::core::Interface for IActivateAudioInterfaceAsyncOperation {
type Vtable = IActivateAudioInterfaceAsyncOperation_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x72a22d78_cde4_431d_b8cc_843a71199b6d);
}
impl ::core::convert::From<IActivateAudioInterfaceAsyncOperation> for ::windows::core::IUnknown {
fn from(value: IActivateAudioInterfaceAsyncOperation) -> Self {
value.0
}
}
impl ::core::convert::From<&IActivateAudioInterfaceAsyncOperation> for ::windows::core::IUnknown {
fn from(value: &IActivateAudioInterfaceAsyncOperation) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IActivateAudioInterfaceAsyncOperation {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IActivateAudioInterfaceAsyncOperation {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IActivateAudioInterfaceAsyncOperation_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, activateresult: *mut ::windows::core::HRESULT, activatedinterface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IActivateAudioInterfaceCompletionHandler(pub ::windows::core::IUnknown);
impl IActivateAudioInterfaceCompletionHandler {
pub unsafe fn ActivateCompleted<'a, Param0: ::windows::core::IntoParam<'a, IActivateAudioInterfaceAsyncOperation>>(&self, activateoperation: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), activateoperation.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IActivateAudioInterfaceCompletionHandler {
type Vtable = IActivateAudioInterfaceCompletionHandler_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x41d949ab_9862_444a_80f6_c261334da5eb);
}
impl ::core::convert::From<IActivateAudioInterfaceCompletionHandler> for ::windows::core::IUnknown {
fn from(value: IActivateAudioInterfaceCompletionHandler) -> Self {
value.0
}
}
impl ::core::convert::From<&IActivateAudioInterfaceCompletionHandler> for ::windows::core::IUnknown {
fn from(value: &IActivateAudioInterfaceCompletionHandler) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IActivateAudioInterfaceCompletionHandler {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IActivateAudioInterfaceCompletionHandler {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IActivateAudioInterfaceCompletionHandler_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, activateoperation: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioAmbisonicsControl(pub ::windows::core::IUnknown);
impl IAudioAmbisonicsControl {
pub unsafe fn SetData(&self, pambisonicsparams: *const AMBISONICS_PARAMS, cbambisonicsparams: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(pambisonicsparams), ::core::mem::transmute(cbambisonicsparams)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetHeadTracking<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, benableheadtracking: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), benableheadtracking.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetHeadTracking(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn SetRotation(&self, x: f32, y: f32, z: f32, w: f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(x), ::core::mem::transmute(y), ::core::mem::transmute(z), ::core::mem::transmute(w)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioAmbisonicsControl {
type Vtable = IAudioAmbisonicsControl_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x28724c91_df35_4856_9f76_d6a26413f3df);
}
impl ::core::convert::From<IAudioAmbisonicsControl> for ::windows::core::IUnknown {
fn from(value: IAudioAmbisonicsControl) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioAmbisonicsControl> for ::windows::core::IUnknown {
fn from(value: &IAudioAmbisonicsControl) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioAmbisonicsControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioAmbisonicsControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioAmbisonicsControl_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pambisonicsparams: *const AMBISONICS_PARAMS, cbambisonicsparams: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, benableheadtracking: super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbenableheadtracking: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, x: f32, y: f32, z: f32, w: f32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioAutoGainControl(pub ::windows::core::IUnknown);
impl IAudioAutoGainControl {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetEnabled(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetEnabled<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, benable: Param0, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), benable.into_param().abi(), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioAutoGainControl {
type Vtable = IAudioAutoGainControl_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x85401fd4_6de4_4b9d_9869_2d6753a82f3c);
}
impl ::core::convert::From<IAudioAutoGainControl> for ::windows::core::IUnknown {
fn from(value: IAudioAutoGainControl) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioAutoGainControl> for ::windows::core::IUnknown {
fn from(value: &IAudioAutoGainControl) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioAutoGainControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioAutoGainControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioAutoGainControl_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbenabled: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, benable: super::super::Foundation::BOOL, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioBass(pub ::windows::core::IUnknown);
impl IAudioBass {
pub unsafe fn GetChannelCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetLevelRange(&self, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(pfminleveldb), ::core::mem::transmute(pfmaxleveldb), ::core::mem::transmute(pfstepping)).ok()
}
pub unsafe fn GetLevel(&self, nchannel: u32) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), &mut result__).from_abi::<f32>(result__)
}
pub unsafe fn SetLevel(&self, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelUniform(&self, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelAllChannels(&self, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(alevelsdb), ::core::mem::transmute(cchannels), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioBass {
type Vtable = IAudioBass_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa2b1a1d9_4db3_425d_a2b2_bd335cb3e2e5);
}
impl ::core::convert::From<IAudioBass> for ::windows::core::IUnknown {
fn from(value: IAudioBass) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioBass> for ::windows::core::IUnknown {
fn from(value: &IAudioBass) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioBass {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioBass {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IAudioBass> for IPerChannelDbLevel {
fn from(value: IAudioBass) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioBass> for IPerChannelDbLevel {
fn from(value: &IAudioBass) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IPerChannelDbLevel> for IAudioBass {
fn into_param(self) -> ::windows::core::Param<'a, IPerChannelDbLevel> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IPerChannelDbLevel> for &IAudioBass {
fn into_param(self) -> ::windows::core::Param<'a, IPerChannelDbLevel> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioBass_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcchannels: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfleveldb: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioCaptureClient(pub ::windows::core::IUnknown);
impl IAudioCaptureClient {
pub unsafe fn GetBuffer(&self, ppdata: *mut *mut u8, pnumframestoread: *mut u32, pdwflags: *mut u32, pu64deviceposition: *mut u64, pu64qpcposition: *mut u64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppdata), ::core::mem::transmute(pnumframestoread), ::core::mem::transmute(pdwflags), ::core::mem::transmute(pu64deviceposition), ::core::mem::transmute(pu64qpcposition)).ok()
}
pub unsafe fn ReleaseBuffer(&self, numframesread: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(numframesread)).ok()
}
pub unsafe fn GetNextPacketSize(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for IAudioCaptureClient {
type Vtable = IAudioCaptureClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc8adbd64_e71e_48a0_a4de_185c395cd317);
}
impl ::core::convert::From<IAudioCaptureClient> for ::windows::core::IUnknown {
fn from(value: IAudioCaptureClient) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioCaptureClient> for ::windows::core::IUnknown {
fn from(value: &IAudioCaptureClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioCaptureClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioCaptureClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioCaptureClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppdata: *mut *mut u8, pnumframestoread: *mut u32, pdwflags: *mut u32, pu64deviceposition: *mut u64, pu64qpcposition: *mut u64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, numframesread: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumframesinnextpacket: *mut u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioChannelConfig(pub ::windows::core::IUnknown);
impl IAudioChannelConfig {
pub unsafe fn SetChannelConfig(&self, dwconfig: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwconfig), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn GetChannelConfig(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for IAudioChannelConfig {
type Vtable = IAudioChannelConfig_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbb11c46f_ec28_493c_b88a_5db88062ce98);
}
impl ::core::convert::From<IAudioChannelConfig> for ::windows::core::IUnknown {
fn from(value: IAudioChannelConfig) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioChannelConfig> for ::windows::core::IUnknown {
fn from(value: &IAudioChannelConfig) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioChannelConfig {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioChannelConfig {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioChannelConfig_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwconfig: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwconfig: *mut u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioClient(pub ::windows::core::IUnknown);
impl IAudioClient {
pub unsafe fn Initialize(&self, sharemode: AUDCLNT_SHAREMODE, streamflags: u32, hnsbufferduration: i64, hnsperiodicity: i64, pformat: *const WAVEFORMATEX, audiosessionguid: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(sharemode), ::core::mem::transmute(streamflags), ::core::mem::transmute(hnsbufferduration), ::core::mem::transmute(hnsperiodicity), ::core::mem::transmute(pformat), ::core::mem::transmute(audiosessionguid)).ok()
}
pub unsafe fn GetBufferSize(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetStreamLatency(&self) -> ::windows::core::Result<i64> {
let mut result__: <i64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i64>(result__)
}
pub unsafe fn GetCurrentPadding(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn IsFormatSupported(&self, sharemode: AUDCLNT_SHAREMODE, pformat: *const WAVEFORMATEX) -> ::windows::core::Result<*mut WAVEFORMATEX> {
let mut result__: <*mut WAVEFORMATEX as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(sharemode), ::core::mem::transmute(pformat), &mut result__).from_abi::<*mut WAVEFORMATEX>(result__)
}
pub unsafe fn GetMixFormat(&self) -> ::windows::core::Result<*mut WAVEFORMATEX> {
let mut result__: <*mut WAVEFORMATEX as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut WAVEFORMATEX>(result__)
}
pub unsafe fn GetDevicePeriod(&self, phnsdefaultdeviceperiod: *mut i64, phnsminimumdeviceperiod: *mut i64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(phnsdefaultdeviceperiod), ::core::mem::transmute(phnsminimumdeviceperiod)).ok()
}
pub unsafe fn Start(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reset(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetEventHandle<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(&self, eventhandle: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), eventhandle.into_param().abi()).ok()
}
pub unsafe fn GetService(&self, riid: *const ::windows::core::GUID, ppv: *mut *mut ::core::ffi::c_void) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(ppv)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioClient {
type Vtable = IAudioClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1cb9ad4c_dbfa_4c32_b178_c2f568a703b2);
}
impl ::core::convert::From<IAudioClient> for ::windows::core::IUnknown {
fn from(value: IAudioClient) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioClient> for ::windows::core::IUnknown {
fn from(value: &IAudioClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sharemode: AUDCLNT_SHAREMODE, streamflags: u32, hnsbufferduration: i64, hnsperiodicity: i64, pformat: *const WAVEFORMATEX, audiosessionguid: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumbufferframes: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, phnslatency: *mut i64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumpaddingframes: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sharemode: AUDCLNT_SHAREMODE, pformat: *const WAVEFORMATEX, ppclosestmatch: *mut *mut WAVEFORMATEX) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppdeviceformat: *mut *mut WAVEFORMATEX) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, phnsdefaultdeviceperiod: *mut i64, phnsminimumdeviceperiod: *mut i64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, eventhandle: super::super::Foundation::HANDLE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, ppv: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioClient2(pub ::windows::core::IUnknown);
impl IAudioClient2 {
pub unsafe fn Initialize(&self, sharemode: AUDCLNT_SHAREMODE, streamflags: u32, hnsbufferduration: i64, hnsperiodicity: i64, pformat: *const WAVEFORMATEX, audiosessionguid: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(sharemode), ::core::mem::transmute(streamflags), ::core::mem::transmute(hnsbufferduration), ::core::mem::transmute(hnsperiodicity), ::core::mem::transmute(pformat), ::core::mem::transmute(audiosessionguid)).ok()
}
pub unsafe fn GetBufferSize(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetStreamLatency(&self) -> ::windows::core::Result<i64> {
let mut result__: <i64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i64>(result__)
}
pub unsafe fn GetCurrentPadding(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn IsFormatSupported(&self, sharemode: AUDCLNT_SHAREMODE, pformat: *const WAVEFORMATEX) -> ::windows::core::Result<*mut WAVEFORMATEX> {
let mut result__: <*mut WAVEFORMATEX as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(sharemode), ::core::mem::transmute(pformat), &mut result__).from_abi::<*mut WAVEFORMATEX>(result__)
}
pub unsafe fn GetMixFormat(&self) -> ::windows::core::Result<*mut WAVEFORMATEX> {
let mut result__: <*mut WAVEFORMATEX as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut WAVEFORMATEX>(result__)
}
pub unsafe fn GetDevicePeriod(&self, phnsdefaultdeviceperiod: *mut i64, phnsminimumdeviceperiod: *mut i64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(phnsdefaultdeviceperiod), ::core::mem::transmute(phnsminimumdeviceperiod)).ok()
}
pub unsafe fn Start(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reset(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetEventHandle<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(&self, eventhandle: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), eventhandle.into_param().abi()).ok()
}
pub unsafe fn GetService(&self, riid: *const ::windows::core::GUID, ppv: *mut *mut ::core::ffi::c_void) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(ppv)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsOffloadCapable(&self, category: AUDIO_STREAM_CATEGORY) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), ::core::mem::transmute(category), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetClientProperties(&self, pproperties: *const AudioClientProperties) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(pproperties)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetBufferSizeLimits<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, pformat: *const WAVEFORMATEX, beventdriven: Param1, phnsminbufferduration: *mut i64, phnsmaxbufferduration: *mut i64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(pformat), beventdriven.into_param().abi(), ::core::mem::transmute(phnsminbufferduration), ::core::mem::transmute(phnsmaxbufferduration)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioClient2 {
type Vtable = IAudioClient2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x726778cd_f60a_4eda_82de_e47610cd78aa);
}
impl ::core::convert::From<IAudioClient2> for ::windows::core::IUnknown {
fn from(value: IAudioClient2) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioClient2> for ::windows::core::IUnknown {
fn from(value: &IAudioClient2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioClient2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioClient2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IAudioClient2> for IAudioClient {
fn from(value: IAudioClient2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioClient2> for IAudioClient {
fn from(value: &IAudioClient2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioClient> for IAudioClient2 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioClient> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioClient> for &IAudioClient2 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioClient> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioClient2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sharemode: AUDCLNT_SHAREMODE, streamflags: u32, hnsbufferduration: i64, hnsperiodicity: i64, pformat: *const WAVEFORMATEX, audiosessionguid: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumbufferframes: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, phnslatency: *mut i64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumpaddingframes: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sharemode: AUDCLNT_SHAREMODE, pformat: *const WAVEFORMATEX, ppclosestmatch: *mut *mut WAVEFORMATEX) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppdeviceformat: *mut *mut WAVEFORMATEX) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, phnsdefaultdeviceperiod: *mut i64, phnsminimumdeviceperiod: *mut i64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, eventhandle: super::super::Foundation::HANDLE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, ppv: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, category: AUDIO_STREAM_CATEGORY, pboffloadcapable: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pproperties: *const AudioClientProperties) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pformat: *const WAVEFORMATEX, beventdriven: super::super::Foundation::BOOL, phnsminbufferduration: *mut i64, phnsmaxbufferduration: *mut i64) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioClient3(pub ::windows::core::IUnknown);
impl IAudioClient3 {
pub unsafe fn Initialize(&self, sharemode: AUDCLNT_SHAREMODE, streamflags: u32, hnsbufferduration: i64, hnsperiodicity: i64, pformat: *const WAVEFORMATEX, audiosessionguid: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(sharemode), ::core::mem::transmute(streamflags), ::core::mem::transmute(hnsbufferduration), ::core::mem::transmute(hnsperiodicity), ::core::mem::transmute(pformat), ::core::mem::transmute(audiosessionguid)).ok()
}
pub unsafe fn GetBufferSize(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetStreamLatency(&self) -> ::windows::core::Result<i64> {
let mut result__: <i64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i64>(result__)
}
pub unsafe fn GetCurrentPadding(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn IsFormatSupported(&self, sharemode: AUDCLNT_SHAREMODE, pformat: *const WAVEFORMATEX) -> ::windows::core::Result<*mut WAVEFORMATEX> {
let mut result__: <*mut WAVEFORMATEX as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(sharemode), ::core::mem::transmute(pformat), &mut result__).from_abi::<*mut WAVEFORMATEX>(result__)
}
pub unsafe fn GetMixFormat(&self) -> ::windows::core::Result<*mut WAVEFORMATEX> {
let mut result__: <*mut WAVEFORMATEX as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<*mut WAVEFORMATEX>(result__)
}
pub unsafe fn GetDevicePeriod(&self, phnsdefaultdeviceperiod: *mut i64, phnsminimumdeviceperiod: *mut i64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(phnsdefaultdeviceperiod), ::core::mem::transmute(phnsminimumdeviceperiod)).ok()
}
pub unsafe fn Start(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reset(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetEventHandle<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(&self, eventhandle: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), eventhandle.into_param().abi()).ok()
}
pub unsafe fn GetService(&self, riid: *const ::windows::core::GUID, ppv: *mut *mut ::core::ffi::c_void) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), ::core::mem::transmute(ppv)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsOffloadCapable(&self, category: AUDIO_STREAM_CATEGORY) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), ::core::mem::transmute(category), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetClientProperties(&self, pproperties: *const AudioClientProperties) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(pproperties)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetBufferSizeLimits<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, pformat: *const WAVEFORMATEX, beventdriven: Param1, phnsminbufferduration: *mut i64, phnsmaxbufferduration: *mut i64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(pformat), beventdriven.into_param().abi(), ::core::mem::transmute(phnsminbufferduration), ::core::mem::transmute(phnsmaxbufferduration)).ok()
}
pub unsafe fn GetSharedModeEnginePeriod(&self, pformat: *const WAVEFORMATEX, pdefaultperiodinframes: *mut u32, pfundamentalperiodinframes: *mut u32, pminperiodinframes: *mut u32, pmaxperiodinframes: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(pformat), ::core::mem::transmute(pdefaultperiodinframes), ::core::mem::transmute(pfundamentalperiodinframes), ::core::mem::transmute(pminperiodinframes), ::core::mem::transmute(pmaxperiodinframes)).ok()
}
pub unsafe fn GetCurrentSharedModeEnginePeriod(&self, ppformat: *mut *mut WAVEFORMATEX, pcurrentperiodinframes: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppformat), ::core::mem::transmute(pcurrentperiodinframes)).ok()
}
pub unsafe fn InitializeSharedAudioStream(&self, streamflags: u32, periodinframes: u32, pformat: *const WAVEFORMATEX, audiosessionguid: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self), ::core::mem::transmute(streamflags), ::core::mem::transmute(periodinframes), ::core::mem::transmute(pformat), ::core::mem::transmute(audiosessionguid)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioClient3 {
type Vtable = IAudioClient3_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ed4ee07_8e67_4cd4_8c1a_2b7a5987ad42);
}
impl ::core::convert::From<IAudioClient3> for ::windows::core::IUnknown {
fn from(value: IAudioClient3) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioClient3> for ::windows::core::IUnknown {
fn from(value: &IAudioClient3) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioClient3 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioClient3 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IAudioClient3> for IAudioClient2 {
fn from(value: IAudioClient3) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioClient3> for IAudioClient2 {
fn from(value: &IAudioClient3) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioClient2> for IAudioClient3 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioClient2> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioClient2> for &IAudioClient3 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioClient2> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
impl ::core::convert::From<IAudioClient3> for IAudioClient {
fn from(value: IAudioClient3) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioClient3> for IAudioClient {
fn from(value: &IAudioClient3) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioClient> for IAudioClient3 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioClient> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioClient> for &IAudioClient3 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioClient> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioClient3_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sharemode: AUDCLNT_SHAREMODE, streamflags: u32, hnsbufferduration: i64, hnsperiodicity: i64, pformat: *const WAVEFORMATEX, audiosessionguid: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumbufferframes: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, phnslatency: *mut i64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnumpaddingframes: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sharemode: AUDCLNT_SHAREMODE, pformat: *const WAVEFORMATEX, ppclosestmatch: *mut *mut WAVEFORMATEX) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppdeviceformat: *mut *mut WAVEFORMATEX) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, phnsdefaultdeviceperiod: *mut i64, phnsminimumdeviceperiod: *mut i64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, eventhandle: super::super::Foundation::HANDLE) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, ppv: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, category: AUDIO_STREAM_CATEGORY, pboffloadcapable: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pproperties: *const AudioClientProperties) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pformat: *const WAVEFORMATEX, beventdriven: super::super::Foundation::BOOL, phnsminbufferduration: *mut i64, phnsmaxbufferduration: *mut i64) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pformat: *const WAVEFORMATEX, pdefaultperiodinframes: *mut u32, pfundamentalperiodinframes: *mut u32, pminperiodinframes: *mut u32, pmaxperiodinframes: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppformat: *mut *mut WAVEFORMATEX, pcurrentperiodinframes: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, streamflags: u32, periodinframes: u32, pformat: *const WAVEFORMATEX, audiosessionguid: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioClientDuckingControl(pub ::windows::core::IUnknown);
impl IAudioClientDuckingControl {
pub unsafe fn SetDuckingOptionsForCurrentStream(&self, options: AUDIO_DUCKING_OPTIONS) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(options)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioClientDuckingControl {
type Vtable = IAudioClientDuckingControl_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc789d381_a28c_4168_b28f_d3a837924dc3);
}
impl ::core::convert::From<IAudioClientDuckingControl> for ::windows::core::IUnknown {
fn from(value: IAudioClientDuckingControl) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioClientDuckingControl> for ::windows::core::IUnknown {
fn from(value: &IAudioClientDuckingControl) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioClientDuckingControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioClientDuckingControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioClientDuckingControl_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, options: AUDIO_DUCKING_OPTIONS) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioClock(pub ::windows::core::IUnknown);
impl IAudioClock {
pub unsafe fn GetFrequency(&self) -> ::windows::core::Result<u64> {
let mut result__: <u64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u64>(result__)
}
pub unsafe fn GetPosition(&self, pu64position: *mut u64, pu64qpcposition: *mut u64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pu64position), ::core::mem::transmute(pu64qpcposition)).ok()
}
pub unsafe fn GetCharacteristics(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for IAudioClock {
type Vtable = IAudioClock_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcd63314f_3fba_4a1b_812c_ef96358728e7);
}
impl ::core::convert::From<IAudioClock> for ::windows::core::IUnknown {
fn from(value: IAudioClock) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioClock> for ::windows::core::IUnknown {
fn from(value: &IAudioClock) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioClock {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioClock {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioClock_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pu64frequency: *mut u64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pu64position: *mut u64, pu64qpcposition: *mut u64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwcharacteristics: *mut u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioClock2(pub ::windows::core::IUnknown);
impl IAudioClock2 {
pub unsafe fn GetDevicePosition(&self, deviceposition: *mut u64, qpcposition: *mut u64) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(deviceposition), ::core::mem::transmute(qpcposition)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioClock2 {
type Vtable = IAudioClock2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6f49ff73_6727_49ac_a008_d98cf5e70048);
}
impl ::core::convert::From<IAudioClock2> for ::windows::core::IUnknown {
fn from(value: IAudioClock2) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioClock2> for ::windows::core::IUnknown {
fn from(value: &IAudioClock2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioClock2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioClock2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioClock2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, deviceposition: *mut u64, qpcposition: *mut u64) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioClockAdjustment(pub ::windows::core::IUnknown);
impl IAudioClockAdjustment {
pub unsafe fn SetSampleRate(&self, flsamplerate: f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(flsamplerate)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioClockAdjustment {
type Vtable = IAudioClockAdjustment_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf6e4c0a0_46d9_4fb8_be21_57a3ef2b626c);
}
impl ::core::convert::From<IAudioClockAdjustment> for ::windows::core::IUnknown {
fn from(value: IAudioClockAdjustment) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioClockAdjustment> for ::windows::core::IUnknown {
fn from(value: &IAudioClockAdjustment) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioClockAdjustment {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioClockAdjustment {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioClockAdjustment_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, flsamplerate: f32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioEffectsChangedNotificationClient(pub ::windows::core::IUnknown);
impl IAudioEffectsChangedNotificationClient {
pub unsafe fn OnAudioEffectsChanged(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioEffectsChangedNotificationClient {
type Vtable = IAudioEffectsChangedNotificationClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa5ded44f_3c5d_4b2b_bd1e_5dc1ee20bbf6);
}
impl ::core::convert::From<IAudioEffectsChangedNotificationClient> for ::windows::core::IUnknown {
fn from(value: IAudioEffectsChangedNotificationClient) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioEffectsChangedNotificationClient> for ::windows::core::IUnknown {
fn from(value: &IAudioEffectsChangedNotificationClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioEffectsChangedNotificationClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioEffectsChangedNotificationClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioEffectsChangedNotificationClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioEffectsManager(pub ::windows::core::IUnknown);
impl IAudioEffectsManager {
pub unsafe fn RegisterAudioEffectsChangedNotificationCallback<'a, Param0: ::windows::core::IntoParam<'a, IAudioEffectsChangedNotificationClient>>(&self, client: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), client.into_param().abi()).ok()
}
pub unsafe fn UnregisterAudioEffectsChangedNotificationCallback<'a, Param0: ::windows::core::IntoParam<'a, IAudioEffectsChangedNotificationClient>>(&self, client: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), client.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetAudioEffects(&self, effects: *mut *mut AUDIO_EFFECT, numeffects: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(effects), ::core::mem::transmute(numeffects)).ok()
}
pub unsafe fn SetAudioEffectState<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, effectid: Param0, state: AUDIO_EFFECT_STATE) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), effectid.into_param().abi(), ::core::mem::transmute(state)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioEffectsManager {
type Vtable = IAudioEffectsManager_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4460b3ae_4b44_4527_8676_7548a8acd260);
}
impl ::core::convert::From<IAudioEffectsManager> for ::windows::core::IUnknown {
fn from(value: IAudioEffectsManager) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioEffectsManager> for ::windows::core::IUnknown {
fn from(value: &IAudioEffectsManager) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioEffectsManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioEffectsManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioEffectsManager_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, client: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, client: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, effects: *mut *mut AUDIO_EFFECT, numeffects: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, effectid: ::windows::core::GUID, state: AUDIO_EFFECT_STATE) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioFormatEnumerator(pub ::windows::core::IUnknown);
impl IAudioFormatEnumerator {
pub unsafe fn GetCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetFormat(&self, index: u32) -> ::windows::core::Result<*mut WAVEFORMATEX> {
let mut result__: <*mut WAVEFORMATEX as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(index), &mut result__).from_abi::<*mut WAVEFORMATEX>(result__)
}
}
unsafe impl ::windows::core::Interface for IAudioFormatEnumerator {
type Vtable = IAudioFormatEnumerator_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdcdaa858_895a_4a22_a5eb_67bda506096d);
}
impl ::core::convert::From<IAudioFormatEnumerator> for ::windows::core::IUnknown {
fn from(value: IAudioFormatEnumerator) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioFormatEnumerator> for ::windows::core::IUnknown {
fn from(value: &IAudioFormatEnumerator) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioFormatEnumerator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioFormatEnumerator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioFormatEnumerator_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, index: u32, format: *mut *mut WAVEFORMATEX) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioInputSelector(pub ::windows::core::IUnknown);
impl IAudioInputSelector {
pub unsafe fn GetSelection(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn SetSelection(&self, nidselect: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nidselect), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioInputSelector {
type Vtable = IAudioInputSelector_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4f03dc02_5e6e_4653_8f72_a030c123d598);
}
impl ::core::convert::From<IAudioInputSelector> for ::windows::core::IUnknown {
fn from(value: IAudioInputSelector) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioInputSelector> for ::windows::core::IUnknown {
fn from(value: &IAudioInputSelector) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioInputSelector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioInputSelector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioInputSelector_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnidselected: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nidselect: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioLoudness(pub ::windows::core::IUnknown);
impl IAudioLoudness {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetEnabled(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetEnabled<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, benable: Param0, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), benable.into_param().abi(), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioLoudness {
type Vtable = IAudioLoudness_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7d8b1437_dd53_4350_9c1b_1ee2890bd938);
}
impl ::core::convert::From<IAudioLoudness> for ::windows::core::IUnknown {
fn from(value: IAudioLoudness) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioLoudness> for ::windows::core::IUnknown {
fn from(value: &IAudioLoudness) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioLoudness {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioLoudness {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioLoudness_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbenabled: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, benable: super::super::Foundation::BOOL, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioMidrange(pub ::windows::core::IUnknown);
impl IAudioMidrange {
pub unsafe fn GetChannelCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetLevelRange(&self, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(pfminleveldb), ::core::mem::transmute(pfmaxleveldb), ::core::mem::transmute(pfstepping)).ok()
}
pub unsafe fn GetLevel(&self, nchannel: u32) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), &mut result__).from_abi::<f32>(result__)
}
pub unsafe fn SetLevel(&self, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelUniform(&self, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelAllChannels(&self, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(alevelsdb), ::core::mem::transmute(cchannels), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioMidrange {
type Vtable = IAudioMidrange_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5e54b6d7_b44b_40d9_9a9e_e691d9ce6edf);
}
impl ::core::convert::From<IAudioMidrange> for ::windows::core::IUnknown {
fn from(value: IAudioMidrange) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioMidrange> for ::windows::core::IUnknown {
fn from(value: &IAudioMidrange) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioMidrange {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioMidrange {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IAudioMidrange> for IPerChannelDbLevel {
fn from(value: IAudioMidrange) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioMidrange> for IPerChannelDbLevel {
fn from(value: &IAudioMidrange) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IPerChannelDbLevel> for IAudioMidrange {
fn into_param(self) -> ::windows::core::Param<'a, IPerChannelDbLevel> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IPerChannelDbLevel> for &IAudioMidrange {
fn into_param(self) -> ::windows::core::Param<'a, IPerChannelDbLevel> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioMidrange_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcchannels: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfleveldb: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioMute(pub ::windows::core::IUnknown);
impl IAudioMute {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetMute<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, bmuted: Param0, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), bmuted.into_param().abi(), ::core::mem::transmute(pguideventcontext)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetMute(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
}
unsafe impl ::windows::core::Interface for IAudioMute {
type Vtable = IAudioMute_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdf45aeea_b74a_4b6b_afad_2366b6aa012e);
}
impl ::core::convert::From<IAudioMute> for ::windows::core::IUnknown {
fn from(value: IAudioMute) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioMute> for ::windows::core::IUnknown {
fn from(value: &IAudioMute) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioMute {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioMute {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioMute_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bmuted: super::super::Foundation::BOOL, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbmuted: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioOutputSelector(pub ::windows::core::IUnknown);
impl IAudioOutputSelector {
pub unsafe fn GetSelection(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn SetSelection(&self, nidselect: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nidselect), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioOutputSelector {
type Vtable = IAudioOutputSelector_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbb515f69_94a7_429e_8b9c_271b3f11a3ab);
}
impl ::core::convert::From<IAudioOutputSelector> for ::windows::core::IUnknown {
fn from(value: IAudioOutputSelector) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioOutputSelector> for ::windows::core::IUnknown {
fn from(value: &IAudioOutputSelector) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioOutputSelector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioOutputSelector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioOutputSelector_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnidselected: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nidselect: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioPeakMeter(pub ::windows::core::IUnknown);
impl IAudioPeakMeter {
pub unsafe fn GetChannelCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetLevel(&self, nchannel: u32) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), &mut result__).from_abi::<f32>(result__)
}
}
unsafe impl ::windows::core::Interface for IAudioPeakMeter {
type Vtable = IAudioPeakMeter_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdd79923c_0599_45e0_b8b6_c8df7db6e796);
}
impl ::core::convert::From<IAudioPeakMeter> for ::windows::core::IUnknown {
fn from(value: IAudioPeakMeter) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioPeakMeter> for ::windows::core::IUnknown {
fn from(value: &IAudioPeakMeter) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioPeakMeter {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioPeakMeter {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioPeakMeter_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcchannels: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pflevel: *mut f32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioRenderClient(pub ::windows::core::IUnknown);
impl IAudioRenderClient {
pub unsafe fn GetBuffer(&self, numframesrequested: u32) -> ::windows::core::Result<*mut u8> {
let mut result__: <*mut u8 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(numframesrequested), &mut result__).from_abi::<*mut u8>(result__)
}
pub unsafe fn ReleaseBuffer(&self, numframeswritten: u32, dwflags: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(numframeswritten), ::core::mem::transmute(dwflags)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioRenderClient {
type Vtable = IAudioRenderClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf294acfc_3146_4483_a7bf_addca7c260e2);
}
impl ::core::convert::From<IAudioRenderClient> for ::windows::core::IUnknown {
fn from(value: IAudioRenderClient) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioRenderClient> for ::windows::core::IUnknown {
fn from(value: &IAudioRenderClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioRenderClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioRenderClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioRenderClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, numframesrequested: u32, ppdata: *mut *mut u8) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, numframeswritten: u32, dwflags: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSessionControl(pub ::windows::core::IUnknown);
impl IAudioSessionControl {
pub unsafe fn GetState(&self) -> ::windows::core::Result<AudioSessionState> {
let mut result__: <AudioSessionState as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioSessionState>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetDisplayName(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetDisplayName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, value: Param0, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), value.into_param().abi(), ::core::mem::transmute(eventcontext)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetIconPath(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetIconPath<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, value: Param0, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), value.into_param().abi(), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn GetGroupingParam(&self) -> ::windows::core::Result<::windows::core::GUID> {
let mut result__: <::windows::core::GUID as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<::windows::core::GUID>(result__)
}
pub unsafe fn SetGroupingParam(&self, r#override: *const ::windows::core::GUID, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#override), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn RegisterAudioSessionNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioSessionEvents>>(&self, newnotifications: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), newnotifications.into_param().abi()).ok()
}
pub unsafe fn UnregisterAudioSessionNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioSessionEvents>>(&self, newnotifications: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), newnotifications.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioSessionControl {
type Vtable = IAudioSessionControl_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf4b1a599_7266_4319_a8ca_e70acb11e8cd);
}
impl ::core::convert::From<IAudioSessionControl> for ::windows::core::IUnknown {
fn from(value: IAudioSessionControl) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSessionControl> for ::windows::core::IUnknown {
fn from(value: &IAudioSessionControl) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSessionControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSessionControl {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSessionControl_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut AudioSessionState) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::PWSTR, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::PWSTR, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#override: *const ::windows::core::GUID, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newnotifications: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newnotifications: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSessionControl2(pub ::windows::core::IUnknown);
impl IAudioSessionControl2 {
pub unsafe fn GetState(&self) -> ::windows::core::Result<AudioSessionState> {
let mut result__: <AudioSessionState as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioSessionState>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetDisplayName(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetDisplayName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, value: Param0, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), value.into_param().abi(), ::core::mem::transmute(eventcontext)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetIconPath(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetIconPath<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, value: Param0, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), value.into_param().abi(), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn GetGroupingParam(&self) -> ::windows::core::Result<::windows::core::GUID> {
let mut result__: <::windows::core::GUID as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<::windows::core::GUID>(result__)
}
pub unsafe fn SetGroupingParam(&self, r#override: *const ::windows::core::GUID, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#override), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn RegisterAudioSessionNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioSessionEvents>>(&self, newnotifications: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), newnotifications.into_param().abi()).ok()
}
pub unsafe fn UnregisterAudioSessionNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioSessionEvents>>(&self, newnotifications: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), newnotifications.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetSessionIdentifier(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetSessionInstanceIdentifier(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
pub unsafe fn GetProcessId(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn IsSystemSoundsSession(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetDuckingPreference<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, optout: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), optout.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioSessionControl2 {
type Vtable = IAudioSessionControl2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbfb7ff88_7239_4fc9_8fa2_07c950be9c6d);
}
impl ::core::convert::From<IAudioSessionControl2> for ::windows::core::IUnknown {
fn from(value: IAudioSessionControl2) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSessionControl2> for ::windows::core::IUnknown {
fn from(value: &IAudioSessionControl2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSessionControl2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSessionControl2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IAudioSessionControl2> for IAudioSessionControl {
fn from(value: IAudioSessionControl2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioSessionControl2> for IAudioSessionControl {
fn from(value: &IAudioSessionControl2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioSessionControl> for IAudioSessionControl2 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioSessionControl> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioSessionControl> for &IAudioSessionControl2 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioSessionControl> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSessionControl2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut AudioSessionState) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::PWSTR, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::PWSTR, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#override: *const ::windows::core::GUID, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newnotifications: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newnotifications: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pretval: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, optout: super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSessionEnumerator(pub ::windows::core::IUnknown);
impl IAudioSessionEnumerator {
pub unsafe fn GetCount(&self) -> ::windows::core::Result<i32> {
let mut result__: <i32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<i32>(result__)
}
pub unsafe fn GetSession(&self, sessioncount: i32) -> ::windows::core::Result<IAudioSessionControl> {
let mut result__: <IAudioSessionControl as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(sessioncount), &mut result__).from_abi::<IAudioSessionControl>(result__)
}
}
unsafe impl ::windows::core::Interface for IAudioSessionEnumerator {
type Vtable = IAudioSessionEnumerator_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe2f5bb11_0570_40ca_acdd_3aa01277dee8);
}
impl ::core::convert::From<IAudioSessionEnumerator> for ::windows::core::IUnknown {
fn from(value: IAudioSessionEnumerator) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSessionEnumerator> for ::windows::core::IUnknown {
fn from(value: &IAudioSessionEnumerator) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSessionEnumerator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSessionEnumerator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSessionEnumerator_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessioncount: *mut i32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessioncount: i32, session: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSessionEvents(pub ::windows::core::IUnknown);
impl IAudioSessionEvents {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnDisplayNameChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, newdisplayname: Param0, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), newdisplayname.into_param().abi(), ::core::mem::transmute(eventcontext)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnIconPathChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, newiconpath: Param0, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), newiconpath.into_param().abi(), ::core::mem::transmute(eventcontext)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnSimpleVolumeChanged<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, newvolume: f32, newmute: Param1, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(newvolume), newmute.into_param().abi(), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn OnChannelVolumeChanged(&self, channelcount: u32, newchannelvolumearray: *const f32, changedchannel: u32, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(channelcount), ::core::mem::transmute(newchannelvolumearray), ::core::mem::transmute(changedchannel), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn OnGroupingParamChanged(&self, newgroupingparam: *const ::windows::core::GUID, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(newgroupingparam), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn OnStateChanged(&self, newstate: AudioSessionState) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(newstate)).ok()
}
pub unsafe fn OnSessionDisconnected(&self, disconnectreason: AudioSessionDisconnectReason) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(disconnectreason)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioSessionEvents {
type Vtable = IAudioSessionEvents_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x24918acc_64b3_37c1_8ca9_74a66e9957a8);
}
impl ::core::convert::From<IAudioSessionEvents> for ::windows::core::IUnknown {
fn from(value: IAudioSessionEvents) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSessionEvents> for ::windows::core::IUnknown {
fn from(value: &IAudioSessionEvents) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSessionEvents {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSessionEvents {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSessionEvents_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newdisplayname: super::super::Foundation::PWSTR, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newiconpath: super::super::Foundation::PWSTR, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newvolume: f32, newmute: super::super::Foundation::BOOL, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, channelcount: u32, newchannelvolumearray: *const f32, changedchannel: u32, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newgroupingparam: *const ::windows::core::GUID, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newstate: AudioSessionState) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, disconnectreason: AudioSessionDisconnectReason) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSessionManager(pub ::windows::core::IUnknown);
impl IAudioSessionManager {
pub unsafe fn GetAudioSessionControl(&self, audiosessionguid: *const ::windows::core::GUID, streamflags: u32) -> ::windows::core::Result<IAudioSessionControl> {
let mut result__: <IAudioSessionControl as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(audiosessionguid), ::core::mem::transmute(streamflags), &mut result__).from_abi::<IAudioSessionControl>(result__)
}
pub unsafe fn GetSimpleAudioVolume(&self, audiosessionguid: *const ::windows::core::GUID, streamflags: u32) -> ::windows::core::Result<ISimpleAudioVolume> {
let mut result__: <ISimpleAudioVolume as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(audiosessionguid), ::core::mem::transmute(streamflags), &mut result__).from_abi::<ISimpleAudioVolume>(result__)
}
}
unsafe impl ::windows::core::Interface for IAudioSessionManager {
type Vtable = IAudioSessionManager_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbfa971f1_4d5e_40bb_935e_967039bfbee4);
}
impl ::core::convert::From<IAudioSessionManager> for ::windows::core::IUnknown {
fn from(value: IAudioSessionManager) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSessionManager> for ::windows::core::IUnknown {
fn from(value: &IAudioSessionManager) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSessionManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSessionManager {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSessionManager_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audiosessionguid: *const ::windows::core::GUID, streamflags: u32, sessioncontrol: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audiosessionguid: *const ::windows::core::GUID, streamflags: u32, audiovolume: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSessionManager2(pub ::windows::core::IUnknown);
impl IAudioSessionManager2 {
pub unsafe fn GetAudioSessionControl(&self, audiosessionguid: *const ::windows::core::GUID, streamflags: u32) -> ::windows::core::Result<IAudioSessionControl> {
let mut result__: <IAudioSessionControl as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(audiosessionguid), ::core::mem::transmute(streamflags), &mut result__).from_abi::<IAudioSessionControl>(result__)
}
pub unsafe fn GetSimpleAudioVolume(&self, audiosessionguid: *const ::windows::core::GUID, streamflags: u32) -> ::windows::core::Result<ISimpleAudioVolume> {
let mut result__: <ISimpleAudioVolume as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(audiosessionguid), ::core::mem::transmute(streamflags), &mut result__).from_abi::<ISimpleAudioVolume>(result__)
}
pub unsafe fn GetSessionEnumerator(&self) -> ::windows::core::Result<IAudioSessionEnumerator> {
let mut result__: <IAudioSessionEnumerator as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IAudioSessionEnumerator>(result__)
}
pub unsafe fn RegisterSessionNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioSessionNotification>>(&self, sessionnotification: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), sessionnotification.into_param().abi()).ok()
}
pub unsafe fn UnregisterSessionNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioSessionNotification>>(&self, sessionnotification: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), sessionnotification.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn RegisterDuckNotification<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, IAudioVolumeDuckNotification>>(&self, sessionid: Param0, ducknotification: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), sessionid.into_param().abi(), ducknotification.into_param().abi()).ok()
}
pub unsafe fn UnregisterDuckNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioVolumeDuckNotification>>(&self, ducknotification: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ducknotification.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioSessionManager2 {
type Vtable = IAudioSessionManager2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x77aa99a0_1bd6_484f_8bc7_2c654c9a9b6f);
}
impl ::core::convert::From<IAudioSessionManager2> for ::windows::core::IUnknown {
fn from(value: IAudioSessionManager2) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSessionManager2> for ::windows::core::IUnknown {
fn from(value: &IAudioSessionManager2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSessionManager2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSessionManager2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IAudioSessionManager2> for IAudioSessionManager {
fn from(value: IAudioSessionManager2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioSessionManager2> for IAudioSessionManager {
fn from(value: &IAudioSessionManager2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioSessionManager> for IAudioSessionManager2 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioSessionManager> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IAudioSessionManager> for &IAudioSessionManager2 {
fn into_param(self) -> ::windows::core::Param<'a, IAudioSessionManager> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSessionManager2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audiosessionguid: *const ::windows::core::GUID, streamflags: u32, sessioncontrol: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audiosessionguid: *const ::windows::core::GUID, streamflags: u32, audiovolume: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionnotification: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionnotification: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: super::super::Foundation::PWSTR, ducknotification: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ducknotification: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSessionNotification(pub ::windows::core::IUnknown);
impl IAudioSessionNotification {
pub unsafe fn OnSessionCreated<'a, Param0: ::windows::core::IntoParam<'a, IAudioSessionControl>>(&self, newsession: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), newsession.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioSessionNotification {
type Vtable = IAudioSessionNotification_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x641dd20b_4d41_49cc_aba3_174b9477bb08);
}
impl ::core::convert::From<IAudioSessionNotification> for ::windows::core::IUnknown {
fn from(value: IAudioSessionNotification) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSessionNotification> for ::windows::core::IUnknown {
fn from(value: &IAudioSessionNotification) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSessionNotification {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSessionNotification {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSessionNotification_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, newsession: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioStateMonitor(pub ::windows::core::IUnknown);
impl IAudioStateMonitor {
pub unsafe fn RegisterCallback(&self, callback: ::core::option::Option<PAudioStateMonitorCallback>, context: *const ::core::ffi::c_void) -> ::windows::core::Result<i64> {
let mut result__: <i64 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(callback), ::core::mem::transmute(context), &mut result__).from_abi::<i64>(result__)
}
pub unsafe fn UnregisterCallback(&self, registration: i64) {
::core::mem::transmute((::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(registration)))
}
pub unsafe fn GetSoundLevel(&self) -> AudioStateMonitorSoundLevel {
::core::mem::transmute((::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)))
}
}
unsafe impl ::windows::core::Interface for IAudioStateMonitor {
type Vtable = IAudioStateMonitor_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x63bd8738_e30d_4c77_bf5c_834e87c657e2);
}
impl ::core::convert::From<IAudioStateMonitor> for ::windows::core::IUnknown {
fn from(value: IAudioStateMonitor) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioStateMonitor> for ::windows::core::IUnknown {
fn from(value: &IAudioStateMonitor) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioStateMonitor {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioStateMonitor {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioStateMonitor_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, callback: ::windows::core::RawPtr, context: *const ::core::ffi::c_void, registration: *mut i64) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, registration: i64),
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> AudioStateMonitorSoundLevel,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioStreamVolume(pub ::windows::core::IUnknown);
impl IAudioStreamVolume {
pub unsafe fn GetChannelCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn SetChannelVolume(&self, dwindex: u32, flevel: f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwindex), ::core::mem::transmute(flevel)).ok()
}
pub unsafe fn GetChannelVolume(&self, dwindex: u32) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwindex), &mut result__).from_abi::<f32>(result__)
}
pub unsafe fn SetAllVolumes(&self, dwcount: u32, pfvolumes: *const f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwcount), ::core::mem::transmute(pfvolumes)).ok()
}
pub unsafe fn GetAllVolumes(&self, dwcount: u32, pfvolumes: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwcount), ::core::mem::transmute(pfvolumes)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioStreamVolume {
type Vtable = IAudioStreamVolume_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x93014887_242d_4068_8a15_cf5e93b90fe3);
}
impl ::core::convert::From<IAudioStreamVolume> for ::windows::core::IUnknown {
fn from(value: IAudioStreamVolume) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioStreamVolume> for ::windows::core::IUnknown {
fn from(value: &IAudioStreamVolume) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioStreamVolume {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioStreamVolume {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioStreamVolume_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwcount: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwindex: u32, flevel: f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwindex: u32, pflevel: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwcount: u32, pfvolumes: *const f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwcount: u32, pfvolumes: *mut f32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSystemEffectsPropertyChangeNotificationClient(pub ::windows::core::IUnknown);
impl IAudioSystemEffectsPropertyChangeNotificationClient {
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub unsafe fn OnPropertyChanged<'a, Param1: ::windows::core::IntoParam<'a, super::super::UI::Shell::PropertiesSystem::PROPERTYKEY>>(&self, r#type: __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002, key: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), key.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioSystemEffectsPropertyChangeNotificationClient {
type Vtable = IAudioSystemEffectsPropertyChangeNotificationClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x20049d40_56d5_400e_a2ef_385599feed49);
}
impl ::core::convert::From<IAudioSystemEffectsPropertyChangeNotificationClient> for ::windows::core::IUnknown {
fn from(value: IAudioSystemEffectsPropertyChangeNotificationClient) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSystemEffectsPropertyChangeNotificationClient> for ::windows::core::IUnknown {
fn from(value: &IAudioSystemEffectsPropertyChangeNotificationClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSystemEffectsPropertyChangeNotificationClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSystemEffectsPropertyChangeNotificationClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSystemEffectsPropertyChangeNotificationClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002, key: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_UI_Shell_PropertiesSystem"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioSystemEffectsPropertyStore(pub ::windows::core::IUnknown);
impl IAudioSystemEffectsPropertyStore {
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub unsafe fn OpenDefaultPropertyStore(&self, stgmaccess: u32) -> ::windows::core::Result<super::super::UI::Shell::PropertiesSystem::IPropertyStore> {
let mut result__: <super::super::UI::Shell::PropertiesSystem::IPropertyStore as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(stgmaccess), &mut result__).from_abi::<super::super::UI::Shell::PropertiesSystem::IPropertyStore>(result__)
}
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub unsafe fn OpenUserPropertyStore(&self, stgmaccess: u32) -> ::windows::core::Result<super::super::UI::Shell::PropertiesSystem::IPropertyStore> {
let mut result__: <super::super::UI::Shell::PropertiesSystem::IPropertyStore as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(stgmaccess), &mut result__).from_abi::<super::super::UI::Shell::PropertiesSystem::IPropertyStore>(result__)
}
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub unsafe fn OpenVolatilePropertyStore(&self, stgmaccess: u32) -> ::windows::core::Result<super::super::UI::Shell::PropertiesSystem::IPropertyStore> {
let mut result__: <super::super::UI::Shell::PropertiesSystem::IPropertyStore as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(stgmaccess), &mut result__).from_abi::<super::super::UI::Shell::PropertiesSystem::IPropertyStore>(result__)
}
pub unsafe fn ResetUserPropertyStore(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn ResetVolatilePropertyStore(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn RegisterPropertyChangeNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioSystemEffectsPropertyChangeNotificationClient>>(&self, callback: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), callback.into_param().abi()).ok()
}
pub unsafe fn UnregisterPropertyChangeNotification<'a, Param0: ::windows::core::IntoParam<'a, IAudioSystemEffectsPropertyChangeNotificationClient>>(&self, callback: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), callback.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioSystemEffectsPropertyStore {
type Vtable = IAudioSystemEffectsPropertyStore_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x302ae7f9_d7e0_43e4_971b_1f8293613d2a);
}
impl ::core::convert::From<IAudioSystemEffectsPropertyStore> for ::windows::core::IUnknown {
fn from(value: IAudioSystemEffectsPropertyStore) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioSystemEffectsPropertyStore> for ::windows::core::IUnknown {
fn from(value: &IAudioSystemEffectsPropertyStore) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioSystemEffectsPropertyStore {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioSystemEffectsPropertyStore {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioSystemEffectsPropertyStore_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stgmaccess: u32, propstore: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_UI_Shell_PropertiesSystem"))] usize,
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stgmaccess: u32, propstore: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_UI_Shell_PropertiesSystem"))] usize,
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stgmaccess: u32, propstore: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_UI_Shell_PropertiesSystem"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, callback: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, callback: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioTreble(pub ::windows::core::IUnknown);
impl IAudioTreble {
pub unsafe fn GetChannelCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetLevelRange(&self, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(pfminleveldb), ::core::mem::transmute(pfmaxleveldb), ::core::mem::transmute(pfstepping)).ok()
}
pub unsafe fn GetLevel(&self, nchannel: u32) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), &mut result__).from_abi::<f32>(result__)
}
pub unsafe fn SetLevel(&self, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelUniform(&self, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelAllChannels(&self, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(alevelsdb), ::core::mem::transmute(cchannels), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioTreble {
type Vtable = IAudioTreble_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0a717812_694e_4907_b74b_bafa5cfdca7b);
}
impl ::core::convert::From<IAudioTreble> for ::windows::core::IUnknown {
fn from(value: IAudioTreble) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioTreble> for ::windows::core::IUnknown {
fn from(value: &IAudioTreble) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioTreble {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioTreble {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IAudioTreble> for IPerChannelDbLevel {
fn from(value: IAudioTreble) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioTreble> for IPerChannelDbLevel {
fn from(value: &IAudioTreble) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IPerChannelDbLevel> for IAudioTreble {
fn into_param(self) -> ::windows::core::Param<'a, IPerChannelDbLevel> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IPerChannelDbLevel> for &IAudioTreble {
fn into_param(self) -> ::windows::core::Param<'a, IPerChannelDbLevel> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioTreble_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcchannels: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfleveldb: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioVolumeDuckNotification(pub ::windows::core::IUnknown);
impl IAudioVolumeDuckNotification {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnVolumeDuckNotification<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, sessionid: Param0, countcommunicationsessions: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), sessionid.into_param().abi(), ::core::mem::transmute(countcommunicationsessions)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnVolumeUnduckNotification<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, sessionid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), sessionid.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioVolumeDuckNotification {
type Vtable = IAudioVolumeDuckNotification_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc3b284d4_6d39_4359_b3cf_b56ddb3bb39c);
}
impl ::core::convert::From<IAudioVolumeDuckNotification> for ::windows::core::IUnknown {
fn from(value: IAudioVolumeDuckNotification) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioVolumeDuckNotification> for ::windows::core::IUnknown {
fn from(value: &IAudioVolumeDuckNotification) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioVolumeDuckNotification {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioVolumeDuckNotification {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioVolumeDuckNotification_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: super::super::Foundation::PWSTR, countcommunicationsessions: u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sessionid: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IAudioVolumeLevel(pub ::windows::core::IUnknown);
impl IAudioVolumeLevel {
pub unsafe fn GetChannelCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetLevelRange(&self, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(pfminleveldb), ::core::mem::transmute(pfmaxleveldb), ::core::mem::transmute(pfstepping)).ok()
}
pub unsafe fn GetLevel(&self, nchannel: u32) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), &mut result__).from_abi::<f32>(result__)
}
pub unsafe fn SetLevel(&self, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelUniform(&self, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelAllChannels(&self, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(alevelsdb), ::core::mem::transmute(cchannels), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IAudioVolumeLevel {
type Vtable = IAudioVolumeLevel_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7fb7b48f_531d_44a2_bcb3_5ad5a134b3dc);
}
impl ::core::convert::From<IAudioVolumeLevel> for ::windows::core::IUnknown {
fn from(value: IAudioVolumeLevel) -> Self {
value.0
}
}
impl ::core::convert::From<&IAudioVolumeLevel> for ::windows::core::IUnknown {
fn from(value: &IAudioVolumeLevel) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IAudioVolumeLevel {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IAudioVolumeLevel {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<IAudioVolumeLevel> for IPerChannelDbLevel {
fn from(value: IAudioVolumeLevel) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&IAudioVolumeLevel> for IPerChannelDbLevel {
fn from(value: &IAudioVolumeLevel) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, IPerChannelDbLevel> for IAudioVolumeLevel {
fn into_param(self) -> ::windows::core::Param<'a, IPerChannelDbLevel> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, IPerChannelDbLevel> for &IAudioVolumeLevel {
fn into_param(self) -> ::windows::core::Param<'a, IPerChannelDbLevel> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IAudioVolumeLevel_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcchannels: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfleveldb: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IChannelAudioVolume(pub ::windows::core::IUnknown);
impl IChannelAudioVolume {
pub unsafe fn GetChannelCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn SetChannelVolume(&self, dwindex: u32, flevel: f32, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwindex), ::core::mem::transmute(flevel), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn GetChannelVolume(&self, dwindex: u32) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwindex), &mut result__).from_abi::<f32>(result__)
}
pub unsafe fn SetAllVolumes(&self, dwcount: u32, pfvolumes: *const f32, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwcount), ::core::mem::transmute(pfvolumes), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn GetAllVolumes(&self, dwcount: u32, pfvolumes: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwcount), ::core::mem::transmute(pfvolumes)).ok()
}
}
unsafe impl ::windows::core::Interface for IChannelAudioVolume {
type Vtable = IChannelAudioVolume_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1c158861_b533_4b30_b1cf_e853e51c59b8);
}
impl ::core::convert::From<IChannelAudioVolume> for ::windows::core::IUnknown {
fn from(value: IChannelAudioVolume) -> Self {
value.0
}
}
impl ::core::convert::From<&IChannelAudioVolume> for ::windows::core::IUnknown {
fn from(value: &IChannelAudioVolume) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IChannelAudioVolume {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IChannelAudioVolume {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IChannelAudioVolume_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwcount: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwindex: u32, flevel: f32, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwindex: u32, pflevel: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwcount: u32, pfvolumes: *const f32, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwcount: u32, pfvolumes: *mut f32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IConnector(pub ::windows::core::IUnknown);
impl IConnector {
pub unsafe fn GetType(&self) -> ::windows::core::Result<ConnectorType> {
let mut result__: <ConnectorType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ConnectorType>(result__)
}
pub unsafe fn GetDataFlow(&self) -> ::windows::core::Result<DataFlow> {
let mut result__: <DataFlow as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<DataFlow>(result__)
}
pub unsafe fn ConnectTo<'a, Param0: ::windows::core::IntoParam<'a, IConnector>>(&self, pconnectto: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pconnectto.into_param().abi()).ok()
}
pub unsafe fn Disconnect(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsConnected(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn GetConnectedTo(&self) -> ::windows::core::Result<IConnector> {
let mut result__: <IConnector as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IConnector>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetConnectorIdConnectedTo(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetDeviceIdConnectedTo(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
}
unsafe impl ::windows::core::Interface for IConnector {
type Vtable = IConnector_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9c2c4058_23f5_41de_877a_df3af236a09e);
}
impl ::core::convert::From<IConnector> for ::windows::core::IUnknown {
fn from(value: IConnector) -> Self {
value.0
}
}
impl ::core::convert::From<&IConnector> for ::windows::core::IUnknown {
fn from(value: &IConnector) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IConnector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IConnector {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IConnector_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ptype: *mut ConnectorType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pflow: *mut DataFlow) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pconnectto: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbconnected: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppconto: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppwstrconnectorid: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppwstrdeviceid: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IControlChangeNotify(pub ::windows::core::IUnknown);
impl IControlChangeNotify {
pub unsafe fn OnNotify(&self, dwsenderprocessid: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwsenderprocessid), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IControlChangeNotify {
type Vtable = IControlChangeNotify_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa09513ed_c709_4d21_bd7b_5f34c47f3947);
}
impl ::core::convert::From<IControlChangeNotify> for ::windows::core::IUnknown {
fn from(value: IControlChangeNotify) -> Self {
value.0
}
}
impl ::core::convert::From<&IControlChangeNotify> for ::windows::core::IUnknown {
fn from(value: &IControlChangeNotify) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IControlChangeNotify {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IControlChangeNotify {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IControlChangeNotify_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwsenderprocessid: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IControlInterface(pub ::windows::core::IUnknown);
impl IControlInterface {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetName(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
pub unsafe fn GetIID(&self) -> ::windows::core::Result<::windows::core::GUID> {
let mut result__: <::windows::core::GUID as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<::windows::core::GUID>(result__)
}
}
unsafe impl ::windows::core::Interface for IControlInterface {
type Vtable = IControlInterface_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x45d37c3f_5140_444a_ae24_400789f3cbf3);
}
impl ::core::convert::From<IControlInterface> for ::windows::core::IUnknown {
fn from(value: IControlInterface) -> Self {
value.0
}
}
impl ::core::convert::From<&IControlInterface> for ::windows::core::IUnknown {
fn from(value: &IControlInterface) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IControlInterface {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IControlInterface {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IControlInterface_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppwstrname: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, piid: *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IDeviceSpecificProperty(pub ::windows::core::IUnknown);
impl IDeviceSpecificProperty {
pub unsafe fn GetType(&self) -> ::windows::core::Result<u16> {
let mut result__: <u16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u16>(result__)
}
pub unsafe fn GetValue(&self, pvvalue: *mut ::core::ffi::c_void, pcbvalue: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pvvalue), ::core::mem::transmute(pcbvalue)).ok()
}
pub unsafe fn SetValue(&self, pvvalue: *const ::core::ffi::c_void, cbvalue: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(pvvalue), ::core::mem::transmute(cbvalue), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn Get4BRange(&self, plmin: *mut i32, plmax: *mut i32, plstepping: *mut i32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(plmin), ::core::mem::transmute(plmax), ::core::mem::transmute(plstepping)).ok()
}
}
unsafe impl ::windows::core::Interface for IDeviceSpecificProperty {
type Vtable = IDeviceSpecificProperty_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3b22bcbf_2586_4af0_8583_205d391b807c);
}
impl ::core::convert::From<IDeviceSpecificProperty> for ::windows::core::IUnknown {
fn from(value: IDeviceSpecificProperty) -> Self {
value.0
}
}
impl ::core::convert::From<&IDeviceSpecificProperty> for ::windows::core::IUnknown {
fn from(value: &IDeviceSpecificProperty) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDeviceSpecificProperty {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IDeviceSpecificProperty {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IDeviceSpecificProperty_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvtype: *mut u16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvvalue: *mut ::core::ffi::c_void, pcbvalue: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvvalue: *const ::core::ffi::c_void, cbvalue: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, plmin: *mut i32, plmax: *mut i32, plstepping: *mut i32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IDeviceTopology(pub ::windows::core::IUnknown);
impl IDeviceTopology {
pub unsafe fn GetConnectorCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetConnector(&self, nindex: u32) -> ::windows::core::Result<IConnector> {
let mut result__: <IConnector as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nindex), &mut result__).from_abi::<IConnector>(result__)
}
pub unsafe fn GetSubunitCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetSubunit(&self, nindex: u32) -> ::windows::core::Result<ISubunit> {
let mut result__: <ISubunit as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(nindex), &mut result__).from_abi::<ISubunit>(result__)
}
pub unsafe fn GetPartById(&self, nid: u32) -> ::windows::core::Result<IPart> {
let mut result__: <IPart as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(nid), &mut result__).from_abi::<IPart>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetDeviceId(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetSignalPath<'a, Param0: ::windows::core::IntoParam<'a, IPart>, Param1: ::windows::core::IntoParam<'a, IPart>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, pipartfrom: Param0, pipartto: Param1, brejectmixedpaths: Param2) -> ::windows::core::Result<IPartsList> {
let mut result__: <IPartsList as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), pipartfrom.into_param().abi(), pipartto.into_param().abi(), brejectmixedpaths.into_param().abi(), &mut result__).from_abi::<IPartsList>(result__)
}
}
unsafe impl ::windows::core::Interface for IDeviceTopology {
type Vtable = IDeviceTopology_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2a07407e_6497_4a18_9787_32f79bd0d98f);
}
impl ::core::convert::From<IDeviceTopology> for ::windows::core::IUnknown {
fn from(value: IDeviceTopology) -> Self {
value.0
}
}
impl ::core::convert::From<&IDeviceTopology> for ::windows::core::IUnknown {
fn from(value: &IDeviceTopology) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDeviceTopology {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IDeviceTopology {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IDeviceTopology_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcount: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nindex: u32, ppconnector: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcount: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nindex: u32, ppsubunit: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nid: u32, pppart: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppwstrdeviceid: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pipartfrom: ::windows::core::RawPtr, pipartto: ::windows::core::RawPtr, brejectmixedpaths: super::super::Foundation::BOOL, ppparts: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IMMDevice(pub ::windows::core::IUnknown);
impl IMMDevice {
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
pub unsafe fn Activate(&self, iid: *const ::windows::core::GUID, dwclsctx: u32, pactivationparams: *const super::super::System::Com::StructuredStorage::PROPVARIANT, ppinterface: *mut *mut ::core::ffi::c_void) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(iid), ::core::mem::transmute(dwclsctx), ::core::mem::transmute(pactivationparams), ::core::mem::transmute(ppinterface)).ok()
}
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub unsafe fn OpenPropertyStore(&self, stgmaccess: u32) -> ::windows::core::Result<super::super::UI::Shell::PropertiesSystem::IPropertyStore> {
let mut result__: <super::super::UI::Shell::PropertiesSystem::IPropertyStore as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(stgmaccess), &mut result__).from_abi::<super::super::UI::Shell::PropertiesSystem::IPropertyStore>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetId(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
pub unsafe fn GetState(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for IMMDevice {
type Vtable = IMMDevice_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd666063f_1587_4e43_81f1_b948e807363f);
}
impl ::core::convert::From<IMMDevice> for ::windows::core::IUnknown {
fn from(value: IMMDevice) -> Self {
value.0
}
}
impl ::core::convert::From<&IMMDevice> for ::windows::core::IUnknown {
fn from(value: &IMMDevice) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMMDevice {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IMMDevice {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IMMDevice_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: *const ::windows::core::GUID, dwclsctx: u32, pactivationparams: *const ::core::mem::ManuallyDrop<super::super::System::Com::StructuredStorage::PROPVARIANT>, ppinterface: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage")))] usize,
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stgmaccess: u32, ppproperties: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_UI_Shell_PropertiesSystem"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppstrid: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwstate: *mut u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IMMDeviceActivator(pub ::windows::core::IUnknown);
impl IMMDeviceActivator {
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
pub unsafe fn Activate<'a, Param1: ::windows::core::IntoParam<'a, IMMDevice>>(&self, iid: *const ::windows::core::GUID, pdevice: Param1, pactivationparams: *const super::super::System::Com::StructuredStorage::PROPVARIANT, ppinterface: *mut *mut ::core::ffi::c_void) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(iid), pdevice.into_param().abi(), ::core::mem::transmute(pactivationparams), ::core::mem::transmute(ppinterface)).ok()
}
}
unsafe impl ::windows::core::Interface for IMMDeviceActivator {
type Vtable = IMMDeviceActivator_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3b0d0ea4_d0a9_4b0e_935b_09516746fac0);
}
impl ::core::convert::From<IMMDeviceActivator> for ::windows::core::IUnknown {
fn from(value: IMMDeviceActivator) -> Self {
value.0
}
}
impl ::core::convert::From<&IMMDeviceActivator> for ::windows::core::IUnknown {
fn from(value: &IMMDeviceActivator) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMMDeviceActivator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IMMDeviceActivator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IMMDeviceActivator_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: *const ::windows::core::GUID, pdevice: ::windows::core::RawPtr, pactivationparams: *const ::core::mem::ManuallyDrop<super::super::System::Com::StructuredStorage::PROPVARIANT>, ppinterface: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IMMDeviceCollection(pub ::windows::core::IUnknown);
impl IMMDeviceCollection {
pub unsafe fn GetCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn Item(&self, ndevice: u32) -> ::windows::core::Result<IMMDevice> {
let mut result__: <IMMDevice as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(ndevice), &mut result__).from_abi::<IMMDevice>(result__)
}
}
unsafe impl ::windows::core::Interface for IMMDeviceCollection {
type Vtable = IMMDeviceCollection_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0bd7a1be_7a1a_44db_8397_cc5392387b5e);
}
impl ::core::convert::From<IMMDeviceCollection> for ::windows::core::IUnknown {
fn from(value: IMMDeviceCollection) -> Self {
value.0
}
}
impl ::core::convert::From<&IMMDeviceCollection> for ::windows::core::IUnknown {
fn from(value: &IMMDeviceCollection) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMMDeviceCollection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IMMDeviceCollection {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IMMDeviceCollection_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcdevices: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ndevice: u32, ppdevice: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IMMDeviceEnumerator(pub ::windows::core::IUnknown);
impl IMMDeviceEnumerator {
pub unsafe fn EnumAudioEndpoints(&self, dataflow: EDataFlow, dwstatemask: u32) -> ::windows::core::Result<IMMDeviceCollection> {
let mut result__: <IMMDeviceCollection as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(dataflow), ::core::mem::transmute(dwstatemask), &mut result__).from_abi::<IMMDeviceCollection>(result__)
}
pub unsafe fn GetDefaultAudioEndpoint(&self, dataflow: EDataFlow, role: ERole) -> ::windows::core::Result<IMMDevice> {
let mut result__: <IMMDevice as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(dataflow), ::core::mem::transmute(role), &mut result__).from_abi::<IMMDevice>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetDevice<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pwstrid: Param0) -> ::windows::core::Result<IMMDevice> {
let mut result__: <IMMDevice as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pwstrid.into_param().abi(), &mut result__).from_abi::<IMMDevice>(result__)
}
pub unsafe fn RegisterEndpointNotificationCallback<'a, Param0: ::windows::core::IntoParam<'a, IMMNotificationClient>>(&self, pclient: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), pclient.into_param().abi()).ok()
}
pub unsafe fn UnregisterEndpointNotificationCallback<'a, Param0: ::windows::core::IntoParam<'a, IMMNotificationClient>>(&self, pclient: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), pclient.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IMMDeviceEnumerator {
type Vtable = IMMDeviceEnumerator_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa95664d2_9614_4f35_a746_de8db63617e6);
}
impl ::core::convert::From<IMMDeviceEnumerator> for ::windows::core::IUnknown {
fn from(value: IMMDeviceEnumerator) -> Self {
value.0
}
}
impl ::core::convert::From<&IMMDeviceEnumerator> for ::windows::core::IUnknown {
fn from(value: &IMMDeviceEnumerator) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMMDeviceEnumerator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IMMDeviceEnumerator {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IMMDeviceEnumerator_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dataflow: EDataFlow, dwstatemask: u32, ppdevices: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dataflow: EDataFlow, role: ERole, ppendpoint: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwstrid: super::super::Foundation::PWSTR, ppdevice: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclient: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclient: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IMMEndpoint(pub ::windows::core::IUnknown);
impl IMMEndpoint {
pub unsafe fn GetDataFlow(&self) -> ::windows::core::Result<EDataFlow> {
let mut result__: <EDataFlow as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<EDataFlow>(result__)
}
}
unsafe impl ::windows::core::Interface for IMMEndpoint {
type Vtable = IMMEndpoint_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1be09788_6894_4089_8586_9a2a6c265ac5);
}
impl ::core::convert::From<IMMEndpoint> for ::windows::core::IUnknown {
fn from(value: IMMEndpoint) -> Self {
value.0
}
}
impl ::core::convert::From<&IMMEndpoint> for ::windows::core::IUnknown {
fn from(value: &IMMEndpoint) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMMEndpoint {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IMMEndpoint {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IMMEndpoint_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdataflow: *mut EDataFlow) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IMMNotificationClient(pub ::windows::core::IUnknown);
impl IMMNotificationClient {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnDeviceStateChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pwstrdeviceid: Param0, dwnewstate: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pwstrdeviceid.into_param().abi(), ::core::mem::transmute(dwnewstate)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnDeviceAdded<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pwstrdeviceid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pwstrdeviceid.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnDeviceRemoved<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pwstrdeviceid: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), pwstrdeviceid.into_param().abi()).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn OnDefaultDeviceChanged<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, flow: EDataFlow, role: ERole, pwstrdefaultdeviceid: Param2) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(flow), ::core::mem::transmute(role), pwstrdefaultdeviceid.into_param().abi()).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Shell_PropertiesSystem"))]
pub unsafe fn OnPropertyValueChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::UI::Shell::PropertiesSystem::PROPERTYKEY>>(&self, pwstrdeviceid: Param0, key: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), pwstrdeviceid.into_param().abi(), key.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IMMNotificationClient {
type Vtable = IMMNotificationClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7991eec9_7e89_4d85_8390_6c703cec60c0);
}
impl ::core::convert::From<IMMNotificationClient> for ::windows::core::IUnknown {
fn from(value: IMMNotificationClient) -> Self {
value.0
}
}
impl ::core::convert::From<&IMMNotificationClient> for ::windows::core::IUnknown {
fn from(value: &IMMNotificationClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMMNotificationClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IMMNotificationClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IMMNotificationClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwstrdeviceid: super::super::Foundation::PWSTR, dwnewstate: u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwstrdeviceid: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwstrdeviceid: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, flow: EDataFlow, role: ERole, pwstrdefaultdeviceid: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Shell_PropertiesSystem"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pwstrdeviceid: super::super::Foundation::PWSTR, key: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_UI_Shell_PropertiesSystem")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IMessageFilter(pub ::windows::core::IUnknown);
impl IMessageFilter {
#[cfg(feature = "Win32_System_Com")]
pub unsafe fn HandleInComingCall<'a, Param1: ::windows::core::IntoParam<'a, super::HTASK>>(&self, dwcalltype: u32, htaskcaller: Param1, dwtickcount: u32, lpinterfaceinfo: *const super::super::System::Com::INTERFACEINFO) -> u32 {
::core::mem::transmute((::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwcalltype), htaskcaller.into_param().abi(), ::core::mem::transmute(dwtickcount), ::core::mem::transmute(lpinterfaceinfo)))
}
pub unsafe fn RetryRejectedCall<'a, Param0: ::windows::core::IntoParam<'a, super::HTASK>>(&self, htaskcallee: Param0, dwtickcount: u32, dwrejecttype: u32) -> u32 {
::core::mem::transmute((::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), htaskcallee.into_param().abi(), ::core::mem::transmute(dwtickcount), ::core::mem::transmute(dwrejecttype)))
}
pub unsafe fn MessagePending<'a, Param0: ::windows::core::IntoParam<'a, super::HTASK>>(&self, htaskcallee: Param0, dwtickcount: u32, dwpendingtype: u32) -> u32 {
::core::mem::transmute((::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), htaskcallee.into_param().abi(), ::core::mem::transmute(dwtickcount), ::core::mem::transmute(dwpendingtype)))
}
}
unsafe impl ::windows::core::Interface for IMessageFilter {
type Vtable = IMessageFilter_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x00000016_0000_0000_c000_000000000046);
}
impl ::core::convert::From<IMessageFilter> for ::windows::core::IUnknown {
fn from(value: IMessageFilter) -> Self {
value.0
}
}
impl ::core::convert::From<&IMessageFilter> for ::windows::core::IUnknown {
fn from(value: &IMessageFilter) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMessageFilter {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IMessageFilter {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IMessageFilter_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwcalltype: u32, htaskcaller: super::HTASK, dwtickcount: u32, lpinterfaceinfo: *const ::core::mem::ManuallyDrop<super::super::System::Com::INTERFACEINFO>) -> u32,
#[cfg(not(feature = "Win32_System_Com"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, htaskcallee: super::HTASK, dwtickcount: u32, dwrejecttype: u32) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, htaskcallee: super::HTASK, dwtickcount: u32, dwpendingtype: u32) -> u32,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IPart(pub ::windows::core::IUnknown);
impl IPart {
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetName(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
pub unsafe fn GetLocalId(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetGlobalId(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> {
let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__)
}
pub unsafe fn GetPartType(&self) -> ::windows::core::Result<PartType> {
let mut result__: <PartType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<PartType>(result__)
}
pub unsafe fn GetSubType(&self) -> ::windows::core::Result<::windows::core::GUID> {
let mut result__: <::windows::core::GUID as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<::windows::core::GUID>(result__)
}
pub unsafe fn GetControlInterfaceCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetControlInterface(&self, nindex: u32) -> ::windows::core::Result<IControlInterface> {
let mut result__: <IControlInterface as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(nindex), &mut result__).from_abi::<IControlInterface>(result__)
}
pub unsafe fn EnumPartsIncoming(&self) -> ::windows::core::Result<IPartsList> {
let mut result__: <IPartsList as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IPartsList>(result__)
}
pub unsafe fn EnumPartsOutgoing(&self) -> ::windows::core::Result<IPartsList> {
let mut result__: <IPartsList as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IPartsList>(result__)
}
pub unsafe fn GetTopologyObject(&self) -> ::windows::core::Result<IDeviceTopology> {
let mut result__: <IDeviceTopology as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IDeviceTopology>(result__)
}
pub unsafe fn Activate(&self, dwclscontext: u32, refiid: *const ::windows::core::GUID, ppvobject: *mut *mut ::core::ffi::c_void) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwclscontext), ::core::mem::transmute(refiid), ::core::mem::transmute(ppvobject)).ok()
}
pub unsafe fn RegisterControlChangeCallback<'a, Param1: ::windows::core::IntoParam<'a, IControlChangeNotify>>(&self, riid: *const ::windows::core::GUID, pnotify: Param1) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(riid), pnotify.into_param().abi()).ok()
}
pub unsafe fn UnregisterControlChangeCallback<'a, Param0: ::windows::core::IntoParam<'a, IControlChangeNotify>>(&self, pnotify: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).15)(::core::mem::transmute_copy(self), pnotify.into_param().abi()).ok()
}
}
unsafe impl ::windows::core::Interface for IPart {
type Vtable = IPart_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xae2de0e4_5bca_4f2d_aa46_5d13f8fdb3a9);
}
impl ::core::convert::From<IPart> for ::windows::core::IUnknown {
fn from(value: IPart) -> Self {
value.0
}
}
impl ::core::convert::From<&IPart> for ::windows::core::IUnknown {
fn from(value: &IPart) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IPart {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IPart {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IPart_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppwstrname: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnid: *mut u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppwstrglobalid: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pparttype: *mut PartType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psubtype: *mut ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcount: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nindex: u32, ppinterfacedesc: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppparts: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppparts: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pptopology: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, dwclscontext: u32, refiid: *const ::windows::core::GUID, ppvobject: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, pnotify: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnotify: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IPartsList(pub ::windows::core::IUnknown);
impl IPartsList {
pub unsafe fn GetCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetPart(&self, nindex: u32) -> ::windows::core::Result<IPart> {
let mut result__: <IPart as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nindex), &mut result__).from_abi::<IPart>(result__)
}
}
unsafe impl ::windows::core::Interface for IPartsList {
type Vtable = IPartsList_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6daa848c_5eb0_45cc_aea5_998a2cda1ffb);
}
impl ::core::convert::From<IPartsList> for ::windows::core::IUnknown {
fn from(value: IPartsList) -> Self {
value.0
}
}
impl ::core::convert::From<&IPartsList> for ::windows::core::IUnknown {
fn from(value: &IPartsList) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IPartsList {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IPartsList {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IPartsList_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcount: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nindex: u32, pppart: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IPerChannelDbLevel(pub ::windows::core::IUnknown);
impl IPerChannelDbLevel {
pub unsafe fn GetChannelCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetLevelRange(&self, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(pfminleveldb), ::core::mem::transmute(pfmaxleveldb), ::core::mem::transmute(pfstepping)).ok()
}
pub unsafe fn GetLevel(&self, nchannel: u32) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), &mut result__).from_abi::<f32>(result__)
}
pub unsafe fn SetLevel(&self, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(nchannel), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelUniform(&self, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(fleveldb), ::core::mem::transmute(pguideventcontext)).ok()
}
pub unsafe fn SetLevelAllChannels(&self, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(alevelsdb), ::core::mem::transmute(cchannels), ::core::mem::transmute(pguideventcontext)).ok()
}
}
unsafe impl ::windows::core::Interface for IPerChannelDbLevel {
type Vtable = IPerChannelDbLevel_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc2f8e001_f205_4bc9_99bc_c13b1e048ccb);
}
impl ::core::convert::From<IPerChannelDbLevel> for ::windows::core::IUnknown {
fn from(value: IPerChannelDbLevel) -> Self {
value.0
}
}
impl ::core::convert::From<&IPerChannelDbLevel> for ::windows::core::IUnknown {
fn from(value: &IPerChannelDbLevel) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IPerChannelDbLevel {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IPerChannelDbLevel {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct IPerChannelDbLevel_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcchannels: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfminleveldb: *mut f32, pfmaxleveldb: *mut f32, pfstepping: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, pfleveldb: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nchannel: u32, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, fleveldb: f32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, alevelsdb: *const f32, cchannels: u32, pguideventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISimpleAudioVolume(pub ::windows::core::IUnknown);
impl ISimpleAudioVolume {
pub unsafe fn SetMasterVolume(&self, flevel: f32, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(flevel), ::core::mem::transmute(eventcontext)).ok()
}
pub unsafe fn GetMasterVolume(&self) -> ::windows::core::Result<f32> {
let mut result__: <f32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<f32>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn SetMute<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, bmute: Param0, eventcontext: *const ::windows::core::GUID) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), bmute.into_param().abi(), ::core::mem::transmute(eventcontext)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetMute(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
}
unsafe impl ::windows::core::Interface for ISimpleAudioVolume {
type Vtable = ISimpleAudioVolume_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x87ce5498_68d6_44e5_9215_6da47ef883d8);
}
impl ::core::convert::From<ISimpleAudioVolume> for ::windows::core::IUnknown {
fn from(value: ISimpleAudioVolume) -> Self {
value.0
}
}
impl ::core::convert::From<&ISimpleAudioVolume> for ::windows::core::IUnknown {
fn from(value: &ISimpleAudioVolume) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISimpleAudioVolume {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISimpleAudioVolume {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISimpleAudioVolume_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, flevel: f32, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pflevel: *mut f32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, bmute: super::super::Foundation::BOOL, eventcontext: *const ::windows::core::GUID) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pbmute: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioClient(pub ::windows::core::IUnknown);
impl ISpatialAudioClient {
pub unsafe fn GetStaticObjectPosition(&self, r#type: AudioObjectType, x: *mut f32, y: *mut f32, z: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), ::core::mem::transmute(x), ::core::mem::transmute(y), ::core::mem::transmute(z)).ok()
}
pub unsafe fn GetNativeStaticObjectTypeMask(&self) -> ::windows::core::Result<AudioObjectType> {
let mut result__: <AudioObjectType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioObjectType>(result__)
}
pub unsafe fn GetMaxDynamicObjectCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetSupportedAudioObjectFormatEnumerator(&self) -> ::windows::core::Result<IAudioFormatEnumerator> {
let mut result__: <IAudioFormatEnumerator as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IAudioFormatEnumerator>(result__)
}
pub unsafe fn GetMaxFrameCount(&self, objectformat: *const WAVEFORMATEX) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(objectformat), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn IsAudioObjectFormatSupported(&self, objectformat: *const WAVEFORMATEX) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(objectformat)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
pub unsafe fn IsSpatialAudioStreamAvailable(&self, streamuuid: *const ::windows::core::GUID, auxiliaryinfo: *const super::super::System::Com::StructuredStorage::PROPVARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(streamuuid), ::core::mem::transmute(auxiliaryinfo)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
pub unsafe fn ActivateSpatialAudioStream<T: ::windows::core::Interface>(&self, activationparams: *const super::super::System::Com::StructuredStorage::PROPVARIANT) -> ::windows::core::Result<T> {
let mut result__ = ::core::option::Option::None;
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(activationparams), &<T as ::windows::core::Interface>::IID, &mut result__ as *mut _ as *mut _).and_some(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioClient {
type Vtable = ISpatialAudioClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbbf8e066_aaaa_49be_9a4d_fd2a858ea27f);
}
impl ::core::convert::From<ISpatialAudioClient> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioClient) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioClient> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: AudioObjectType, x: *mut f32, y: *mut f32, z: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mask: *mut AudioObjectType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enumerator: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, objectformat: *const WAVEFORMATEX, framecountperbuffer: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, objectformat: *const WAVEFORMATEX) -> ::windows::core::HRESULT,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, streamuuid: *const ::windows::core::GUID, auxiliaryinfo: *const ::core::mem::ManuallyDrop<super::super::System::Com::StructuredStorage::PROPVARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, activationparams: *const ::core::mem::ManuallyDrop<super::super::System::Com::StructuredStorage::PROPVARIANT>, riid: *const ::windows::core::GUID, stream: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage")))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioClient2(pub ::windows::core::IUnknown);
impl ISpatialAudioClient2 {
pub unsafe fn GetStaticObjectPosition(&self, r#type: AudioObjectType, x: *mut f32, y: *mut f32, z: *mut f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), ::core::mem::transmute(x), ::core::mem::transmute(y), ::core::mem::transmute(z)).ok()
}
pub unsafe fn GetNativeStaticObjectTypeMask(&self) -> ::windows::core::Result<AudioObjectType> {
let mut result__: <AudioObjectType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioObjectType>(result__)
}
pub unsafe fn GetMaxDynamicObjectCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetSupportedAudioObjectFormatEnumerator(&self) -> ::windows::core::Result<IAudioFormatEnumerator> {
let mut result__: <IAudioFormatEnumerator as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IAudioFormatEnumerator>(result__)
}
pub unsafe fn GetMaxFrameCount(&self, objectformat: *const WAVEFORMATEX) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(objectformat), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn IsAudioObjectFormatSupported(&self, objectformat: *const WAVEFORMATEX) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(objectformat)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
pub unsafe fn IsSpatialAudioStreamAvailable(&self, streamuuid: *const ::windows::core::GUID, auxiliaryinfo: *const super::super::System::Com::StructuredStorage::PROPVARIANT) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(streamuuid), ::core::mem::transmute(auxiliaryinfo)).ok()
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
pub unsafe fn ActivateSpatialAudioStream<T: ::windows::core::Interface>(&self, activationparams: *const super::super::System::Com::StructuredStorage::PROPVARIANT) -> ::windows::core::Result<T> {
let mut result__ = ::core::option::Option::None;
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(activationparams), &<T as ::windows::core::Interface>::IID, &mut result__ as *mut _ as *mut _).and_some(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsOffloadCapable(&self, category: AUDIO_STREAM_CATEGORY) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(category), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn GetMaxFrameCountForCategory<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, category: AUDIO_STREAM_CATEGORY, offloadenabled: Param1, objectformat: *const WAVEFORMATEX) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(category), offloadenabled.into_param().abi(), ::core::mem::transmute(objectformat), &mut result__).from_abi::<u32>(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioClient2 {
type Vtable = ISpatialAudioClient2_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcaabe452_a66a_4bee_a93e_e320463f6a53);
}
impl ::core::convert::From<ISpatialAudioClient2> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioClient2) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioClient2> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioClient2) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioClient2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioClient2 {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ISpatialAudioClient2> for ISpatialAudioClient {
fn from(value: ISpatialAudioClient2) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ISpatialAudioClient2> for ISpatialAudioClient {
fn from(value: &ISpatialAudioClient2) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioClient> for ISpatialAudioClient2 {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioClient> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioClient> for &ISpatialAudioClient2 {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioClient> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioClient2_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: AudioObjectType, x: *mut f32, y: *mut f32, z: *mut f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mask: *mut AudioObjectType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, enumerator: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, objectformat: *const WAVEFORMATEX, framecountperbuffer: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, objectformat: *const WAVEFORMATEX) -> ::windows::core::HRESULT,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, streamuuid: *const ::windows::core::GUID, auxiliaryinfo: *const ::core::mem::ManuallyDrop<super::super::System::Com::StructuredStorage::PROPVARIANT>) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage")))] usize,
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, activationparams: *const ::core::mem::ManuallyDrop<super::super::System::Com::StructuredStorage::PROPVARIANT>, riid: *const ::windows::core::GUID, stream: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
#[cfg(not(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage")))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, category: AUDIO_STREAM_CATEGORY, isoffloadcapable: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, category: AUDIO_STREAM_CATEGORY, offloadenabled: super::super::Foundation::BOOL, objectformat: *const WAVEFORMATEX, framecountperbuffer: *mut u32) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioMetadataClient(pub ::windows::core::IUnknown);
impl ISpatialAudioMetadataClient {
pub unsafe fn ActivateSpatialAudioMetadataItems(&self, maxitemcount: u16, framecount: u16, metadataitemsbuffer: *mut ::core::option::Option<ISpatialAudioMetadataItemsBuffer>, metadataitems: *mut ::core::option::Option<ISpatialAudioMetadataItems>) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(maxitemcount), ::core::mem::transmute(framecount), ::core::mem::transmute(metadataitemsbuffer), ::core::mem::transmute(metadataitems)).ok()
}
pub unsafe fn GetSpatialAudioMetadataItemsBufferLength(&self, maxitemcount: u16) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(maxitemcount), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn ActivateSpatialAudioMetadataWriter(&self, overflowmode: SpatialAudioMetadataWriterOverflowMode) -> ::windows::core::Result<ISpatialAudioMetadataWriter> {
let mut result__: <ISpatialAudioMetadataWriter as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(overflowmode), &mut result__).from_abi::<ISpatialAudioMetadataWriter>(result__)
}
pub unsafe fn ActivateSpatialAudioMetadataCopier(&self) -> ::windows::core::Result<ISpatialAudioMetadataCopier> {
let mut result__: <ISpatialAudioMetadataCopier as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ISpatialAudioMetadataCopier>(result__)
}
pub unsafe fn ActivateSpatialAudioMetadataReader(&self) -> ::windows::core::Result<ISpatialAudioMetadataReader> {
let mut result__: <ISpatialAudioMetadataReader as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ISpatialAudioMetadataReader>(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioMetadataClient {
type Vtable = ISpatialAudioMetadataClient_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x777d4a3b_f6ff_4a26_85dc_68d7cdeda1d4);
}
impl ::core::convert::From<ISpatialAudioMetadataClient> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioMetadataClient) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioMetadataClient> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioMetadataClient) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioMetadataClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioMetadataClient {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioMetadataClient_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, maxitemcount: u16, framecount: u16, metadataitemsbuffer: *mut ::windows::core::RawPtr, metadataitems: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, maxitemcount: u16, bufferlength: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, overflowmode: SpatialAudioMetadataWriterOverflowMode, metadatawriter: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, metadatacopier: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, metadatareader: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioMetadataCopier(pub ::windows::core::IUnknown);
impl ISpatialAudioMetadataCopier {
pub unsafe fn Open<'a, Param0: ::windows::core::IntoParam<'a, ISpatialAudioMetadataItems>>(&self, metadataitems: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), metadataitems.into_param().abi()).ok()
}
pub unsafe fn CopyMetadataForFrames<'a, Param2: ::windows::core::IntoParam<'a, ISpatialAudioMetadataItems>>(&self, copyframecount: u16, copymode: SpatialAudioMetadataCopyMode, dstmetadataitems: Param2) -> ::windows::core::Result<u16> {
let mut result__: <u16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(copyframecount), ::core::mem::transmute(copymode), dstmetadataitems.into_param().abi(), &mut result__).from_abi::<u16>(result__)
}
pub unsafe fn Close(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioMetadataCopier {
type Vtable = ISpatialAudioMetadataCopier_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd224b233_e251_4fd0_9ca2_d5ecf9a68404);
}
impl ::core::convert::From<ISpatialAudioMetadataCopier> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioMetadataCopier) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioMetadataCopier> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioMetadataCopier) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioMetadataCopier {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioMetadataCopier {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioMetadataCopier_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, metadataitems: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, copyframecount: u16, copymode: SpatialAudioMetadataCopyMode, dstmetadataitems: ::windows::core::RawPtr, itemscopied: *mut u16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioMetadataItems(pub ::windows::core::IUnknown);
impl ISpatialAudioMetadataItems {
pub unsafe fn GetFrameCount(&self) -> ::windows::core::Result<u16> {
let mut result__: <u16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u16>(result__)
}
pub unsafe fn GetItemCount(&self) -> ::windows::core::Result<u16> {
let mut result__: <u16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u16>(result__)
}
pub unsafe fn GetMaxItemCount(&self) -> ::windows::core::Result<u16> {
let mut result__: <u16 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u16>(result__)
}
pub unsafe fn GetMaxValueBufferLength(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetInfo(&self) -> ::windows::core::Result<SpatialAudioMetadataItemsInfo> {
let mut result__: <SpatialAudioMetadataItemsInfo as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<SpatialAudioMetadataItemsInfo>(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioMetadataItems {
type Vtable = ISpatialAudioMetadataItems_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbcd7c78f_3098_4f22_b547_a2f25a381269);
}
impl ::core::convert::From<ISpatialAudioMetadataItems> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioMetadataItems) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioMetadataItems> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioMetadataItems) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioMetadataItems {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioMetadataItems {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioMetadataItems_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, framecount: *mut u16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itemcount: *mut u16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, maxitemcount: *mut u16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, maxvaluebufferlength: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, info: *mut SpatialAudioMetadataItemsInfo) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioMetadataItemsBuffer(pub ::windows::core::IUnknown);
impl ISpatialAudioMetadataItemsBuffer {
pub unsafe fn AttachToBuffer(&self, buffer: *mut u8, bufferlength: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlength)).ok()
}
pub unsafe fn AttachToPopulatedBuffer(&self, buffer: *mut u8, bufferlength: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlength)).ok()
}
pub unsafe fn DetachBuffer(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioMetadataItemsBuffer {
type Vtable = ISpatialAudioMetadataItemsBuffer_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x42640a16_e1bd_42d9_9ff6_031ab71a2dba);
}
impl ::core::convert::From<ISpatialAudioMetadataItemsBuffer> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioMetadataItemsBuffer) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioMetadataItemsBuffer> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioMetadataItemsBuffer) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioMetadataItemsBuffer {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioMetadataItemsBuffer {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioMetadataItemsBuffer_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: *mut u8, bufferlength: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: *mut u8, bufferlength: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioMetadataReader(pub ::windows::core::IUnknown);
impl ISpatialAudioMetadataReader {
pub unsafe fn Open<'a, Param0: ::windows::core::IntoParam<'a, ISpatialAudioMetadataItems>>(&self, metadataitems: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), metadataitems.into_param().abi()).ok()
}
pub unsafe fn ReadNextItem(&self, commandcount: *mut u8, frameoffset: *mut u16) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(commandcount), ::core::mem::transmute(frameoffset)).ok()
}
pub unsafe fn ReadNextItemCommand(&self, commandid: *mut u8, valuebuffer: *mut ::core::ffi::c_void, maxvaluebufferlength: u32, valuebufferlength: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(commandid), ::core::mem::transmute(valuebuffer), ::core::mem::transmute(maxvaluebufferlength), ::core::mem::transmute(valuebufferlength)).ok()
}
pub unsafe fn Close(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioMetadataReader {
type Vtable = ISpatialAudioMetadataReader_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb78e86a2_31d9_4c32_94d2_7df40fc7ebec);
}
impl ::core::convert::From<ISpatialAudioMetadataReader> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioMetadataReader) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioMetadataReader> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioMetadataReader) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioMetadataReader {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioMetadataReader {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioMetadataReader_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, metadataitems: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, commandcount: *mut u8, frameoffset: *mut u16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, commandid: *mut u8, valuebuffer: *mut ::core::ffi::c_void, maxvaluebufferlength: u32, valuebufferlength: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioMetadataWriter(pub ::windows::core::IUnknown);
impl ISpatialAudioMetadataWriter {
pub unsafe fn Open<'a, Param0: ::windows::core::IntoParam<'a, ISpatialAudioMetadataItems>>(&self, metadataitems: Param0) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), metadataitems.into_param().abi()).ok()
}
pub unsafe fn WriteNextItem(&self, frameoffset: u16) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(frameoffset)).ok()
}
pub unsafe fn WriteNextItemCommand(&self, commandid: u8, valuebuffer: *const ::core::ffi::c_void, valuebufferlength: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(commandid), ::core::mem::transmute(valuebuffer), ::core::mem::transmute(valuebufferlength)).ok()
}
pub unsafe fn Close(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioMetadataWriter {
type Vtable = ISpatialAudioMetadataWriter_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1b17ca01_2955_444d_a430_537dc589a844);
}
impl ::core::convert::From<ISpatialAudioMetadataWriter> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioMetadataWriter) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioMetadataWriter> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioMetadataWriter) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioMetadataWriter {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioMetadataWriter {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioMetadataWriter_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, metadataitems: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, frameoffset: u16) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, commandid: u8, valuebuffer: *const ::core::ffi::c_void, valuebufferlength: u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObject(pub ::windows::core::IUnknown);
impl ISpatialAudioObject {
pub unsafe fn GetBuffer(&self, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlength)).ok()
}
pub unsafe fn SetEndOfStream(&self, framecount: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(framecount)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsActive(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn GetAudioObjectType(&self) -> ::windows::core::Result<AudioObjectType> {
let mut result__: <AudioObjectType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioObjectType>(result__)
}
pub unsafe fn SetPosition(&self, x: f32, y: f32, z: f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(x), ::core::mem::transmute(y), ::core::mem::transmute(z)).ok()
}
pub unsafe fn SetVolume(&self, volume: f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(volume)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObject {
type Vtable = ISpatialAudioObject_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdde28967_521b_46e5_8f00_bd6f2bc8ab1d);
}
impl ::core::convert::From<ISpatialAudioObject> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObject) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObject> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObject) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObject {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObject {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ISpatialAudioObject> for ISpatialAudioObjectBase {
fn from(value: ISpatialAudioObject) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ISpatialAudioObject> for ISpatialAudioObjectBase {
fn from(value: &ISpatialAudioObject) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectBase> for ISpatialAudioObject {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectBase> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectBase> for &ISpatialAudioObject {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectBase> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObject_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, framecount: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, isactive: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audioobjecttype: *mut AudioObjectType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, x: f32, y: f32, z: f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, volume: f32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectBase(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectBase {
pub unsafe fn GetBuffer(&self, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlength)).ok()
}
pub unsafe fn SetEndOfStream(&self, framecount: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(framecount)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsActive(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn GetAudioObjectType(&self) -> ::windows::core::Result<AudioObjectType> {
let mut result__: <AudioObjectType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioObjectType>(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectBase {
type Vtable = ISpatialAudioObjectBase_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcce0b8f2_8d4d_4efb_a8cf_3d6ecf1c30e0);
}
impl ::core::convert::From<ISpatialAudioObjectBase> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectBase) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectBase> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectBase) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectBase {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectBase {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectBase_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, framecount: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, isactive: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audioobjecttype: *mut AudioObjectType) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectForHrtf(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectForHrtf {
pub unsafe fn GetBuffer(&self, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlength)).ok()
}
pub unsafe fn SetEndOfStream(&self, framecount: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(framecount)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsActive(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn GetAudioObjectType(&self) -> ::windows::core::Result<AudioObjectType> {
let mut result__: <AudioObjectType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioObjectType>(result__)
}
pub unsafe fn SetPosition(&self, x: f32, y: f32, z: f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(x), ::core::mem::transmute(y), ::core::mem::transmute(z)).ok()
}
pub unsafe fn SetGain(&self, gain: f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(gain)).ok()
}
pub unsafe fn SetOrientation(&self, orientation: *const *const f32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(orientation)).ok()
}
pub unsafe fn SetEnvironment(&self, environment: SpatialAudioHrtfEnvironmentType) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(environment)).ok()
}
pub unsafe fn SetDistanceDecay(&self, distancedecay: *const SpatialAudioHrtfDistanceDecay) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(distancedecay)).ok()
}
pub unsafe fn SetDirectivity(&self, directivity: *const SpatialAudioHrtfDirectivityUnion) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(directivity)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectForHrtf {
type Vtable = ISpatialAudioObjectForHrtf_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd7436ade_1978_4e14_aba0_555bd8eb83b4);
}
impl ::core::convert::From<ISpatialAudioObjectForHrtf> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectForHrtf) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectForHrtf> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectForHrtf) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectForHrtf {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectForHrtf {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ISpatialAudioObjectForHrtf> for ISpatialAudioObjectBase {
fn from(value: ISpatialAudioObjectForHrtf) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ISpatialAudioObjectForHrtf> for ISpatialAudioObjectBase {
fn from(value: &ISpatialAudioObjectForHrtf) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectBase> for ISpatialAudioObjectForHrtf {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectBase> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectBase> for &ISpatialAudioObjectForHrtf {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectBase> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectForHrtf_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, framecount: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, isactive: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audioobjecttype: *mut AudioObjectType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, x: f32, y: f32, z: f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, gain: f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, orientation: *const *const f32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, environment: SpatialAudioHrtfEnvironmentType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, distancedecay: *const SpatialAudioHrtfDistanceDecay) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, directivity: *const SpatialAudioHrtfDirectivityUnion) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectForMetadataCommands(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectForMetadataCommands {
pub unsafe fn GetBuffer(&self, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlength)).ok()
}
pub unsafe fn SetEndOfStream(&self, framecount: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(framecount)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsActive(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn GetAudioObjectType(&self) -> ::windows::core::Result<AudioObjectType> {
let mut result__: <AudioObjectType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioObjectType>(result__)
}
pub unsafe fn WriteNextMetadataCommand(&self, commandid: u8, valuebuffer: *const ::core::ffi::c_void, valuebufferlength: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(commandid), ::core::mem::transmute(valuebuffer), ::core::mem::transmute(valuebufferlength)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectForMetadataCommands {
type Vtable = ISpatialAudioObjectForMetadataCommands_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0df2c94b_f5f9_472d_af6b_c46e0ac9cd05);
}
impl ::core::convert::From<ISpatialAudioObjectForMetadataCommands> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectForMetadataCommands) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectForMetadataCommands> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectForMetadataCommands) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectForMetadataCommands {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectForMetadataCommands {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ISpatialAudioObjectForMetadataCommands> for ISpatialAudioObjectBase {
fn from(value: ISpatialAudioObjectForMetadataCommands) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ISpatialAudioObjectForMetadataCommands> for ISpatialAudioObjectBase {
fn from(value: &ISpatialAudioObjectForMetadataCommands) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectBase> for ISpatialAudioObjectForMetadataCommands {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectBase> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectBase> for &ISpatialAudioObjectForMetadataCommands {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectBase> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectForMetadataCommands_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, framecount: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, isactive: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audioobjecttype: *mut AudioObjectType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, commandid: u8, valuebuffer: *const ::core::ffi::c_void, valuebufferlength: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectForMetadataItems(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectForMetadataItems {
pub unsafe fn GetBuffer(&self, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlength)).ok()
}
pub unsafe fn SetEndOfStream(&self, framecount: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(framecount)).ok()
}
#[cfg(feature = "Win32_Foundation")]
pub unsafe fn IsActive(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> {
let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__)
}
pub unsafe fn GetAudioObjectType(&self) -> ::windows::core::Result<AudioObjectType> {
let mut result__: <AudioObjectType as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<AudioObjectType>(result__)
}
pub unsafe fn GetSpatialAudioMetadataItems(&self) -> ::windows::core::Result<ISpatialAudioMetadataItems> {
let mut result__: <ISpatialAudioMetadataItems as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), &mut result__).from_abi::<ISpatialAudioMetadataItems>(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectForMetadataItems {
type Vtable = ISpatialAudioObjectForMetadataItems_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xddea49ff_3bc0_4377_8aad_9fbcfd808566);
}
impl ::core::convert::From<ISpatialAudioObjectForMetadataItems> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectForMetadataItems) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectForMetadataItems> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectForMetadataItems) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectForMetadataItems {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectForMetadataItems {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ISpatialAudioObjectForMetadataItems> for ISpatialAudioObjectBase {
fn from(value: ISpatialAudioObjectForMetadataItems) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ISpatialAudioObjectForMetadataItems> for ISpatialAudioObjectBase {
fn from(value: &ISpatialAudioObjectForMetadataItems) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectBase> for ISpatialAudioObjectForMetadataItems {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectBase> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectBase> for &ISpatialAudioObjectForMetadataItems {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectBase> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectForMetadataItems_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: *mut *mut u8, bufferlength: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, framecount: u32) -> ::windows::core::HRESULT,
#[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, isactive: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT,
#[cfg(not(feature = "Win32_Foundation"))] usize,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, audioobjecttype: *mut AudioObjectType) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, metadataitems: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectRenderStream(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectRenderStream {
pub unsafe fn GetAvailableDynamicObjectCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetService<T: ::windows::core::Interface>(&self) -> ::windows::core::Result<T> {
let mut result__ = ::core::option::Option::None;
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &<T as ::windows::core::Interface>::IID, &mut result__ as *mut _ as *mut _).and_some(result__)
}
pub unsafe fn Start(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reset(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn BeginUpdatingAudioObjects(&self, availabledynamicobjectcount: *mut u32, framecountperbuffer: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(availabledynamicobjectcount), ::core::mem::transmute(framecountperbuffer)).ok()
}
pub unsafe fn EndUpdatingAudioObjects(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn ActivateSpatialAudioObject(&self, r#type: AudioObjectType) -> ::windows::core::Result<ISpatialAudioObject> {
let mut result__: <ISpatialAudioObject as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), &mut result__).from_abi::<ISpatialAudioObject>(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectRenderStream {
type Vtable = ISpatialAudioObjectRenderStream_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbab5f473_b423_477b_85f5_b5a332a04153);
}
impl ::core::convert::From<ISpatialAudioObjectRenderStream> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectRenderStream) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectRenderStream> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectRenderStream) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectRenderStream {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectRenderStream {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ISpatialAudioObjectRenderStream> for ISpatialAudioObjectRenderStreamBase {
fn from(value: ISpatialAudioObjectRenderStream) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ISpatialAudioObjectRenderStream> for ISpatialAudioObjectRenderStreamBase {
fn from(value: &ISpatialAudioObjectRenderStream) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectRenderStreamBase> for ISpatialAudioObjectRenderStream {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectRenderStreamBase> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectRenderStreamBase> for &ISpatialAudioObjectRenderStream {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectRenderStreamBase> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectRenderStream_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, service: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, availabledynamicobjectcount: *mut u32, framecountperbuffer: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: AudioObjectType, audioobject: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectRenderStreamBase(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectRenderStreamBase {
pub unsafe fn GetAvailableDynamicObjectCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetService<T: ::windows::core::Interface>(&self) -> ::windows::core::Result<T> {
let mut result__ = ::core::option::Option::None;
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &<T as ::windows::core::Interface>::IID, &mut result__ as *mut _ as *mut _).and_some(result__)
}
pub unsafe fn Start(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reset(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn BeginUpdatingAudioObjects(&self, availabledynamicobjectcount: *mut u32, framecountperbuffer: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(availabledynamicobjectcount), ::core::mem::transmute(framecountperbuffer)).ok()
}
pub unsafe fn EndUpdatingAudioObjects(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectRenderStreamBase {
type Vtable = ISpatialAudioObjectRenderStreamBase_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfeaaf403_c1d8_450d_aa05_e0ccee7502a8);
}
impl ::core::convert::From<ISpatialAudioObjectRenderStreamBase> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectRenderStreamBase) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectRenderStreamBase> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectRenderStreamBase) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectRenderStreamBase {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectRenderStreamBase {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectRenderStreamBase_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, service: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, availabledynamicobjectcount: *mut u32, framecountperbuffer: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectRenderStreamForHrtf(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectRenderStreamForHrtf {
pub unsafe fn GetAvailableDynamicObjectCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetService<T: ::windows::core::Interface>(&self) -> ::windows::core::Result<T> {
let mut result__ = ::core::option::Option::None;
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &<T as ::windows::core::Interface>::IID, &mut result__ as *mut _ as *mut _).and_some(result__)
}
pub unsafe fn Start(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reset(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn BeginUpdatingAudioObjects(&self, availabledynamicobjectcount: *mut u32, framecountperbuffer: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(availabledynamicobjectcount), ::core::mem::transmute(framecountperbuffer)).ok()
}
pub unsafe fn EndUpdatingAudioObjects(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn ActivateSpatialAudioObjectForHrtf(&self, r#type: AudioObjectType) -> ::windows::core::Result<ISpatialAudioObjectForHrtf> {
let mut result__: <ISpatialAudioObjectForHrtf as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), &mut result__).from_abi::<ISpatialAudioObjectForHrtf>(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectRenderStreamForHrtf {
type Vtable = ISpatialAudioObjectRenderStreamForHrtf_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe08deef9_5363_406e_9fdc_080ee247bbe0);
}
impl ::core::convert::From<ISpatialAudioObjectRenderStreamForHrtf> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectRenderStreamForHrtf) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectRenderStreamForHrtf> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectRenderStreamForHrtf) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectRenderStreamForHrtf {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectRenderStreamForHrtf {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ISpatialAudioObjectRenderStreamForHrtf> for ISpatialAudioObjectRenderStreamBase {
fn from(value: ISpatialAudioObjectRenderStreamForHrtf) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ISpatialAudioObjectRenderStreamForHrtf> for ISpatialAudioObjectRenderStreamBase {
fn from(value: &ISpatialAudioObjectRenderStreamForHrtf) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectRenderStreamBase> for ISpatialAudioObjectRenderStreamForHrtf {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectRenderStreamBase> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectRenderStreamBase> for &ISpatialAudioObjectRenderStreamForHrtf {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectRenderStreamBase> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectRenderStreamForHrtf_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, service: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, availabledynamicobjectcount: *mut u32, framecountperbuffer: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: AudioObjectType, audioobject: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectRenderStreamForMetadata(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectRenderStreamForMetadata {
pub unsafe fn GetAvailableDynamicObjectCount(&self) -> ::windows::core::Result<u32> {
let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__)
}
pub unsafe fn GetService<T: ::windows::core::Interface>(&self) -> ::windows::core::Result<T> {
let mut result__ = ::core::option::Option::None;
(::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &<T as ::windows::core::Interface>::IID, &mut result__ as *mut _ as *mut _).and_some(result__)
}
pub unsafe fn Start(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Stop(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn Reset(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn BeginUpdatingAudioObjects(&self, availabledynamicobjectcount: *mut u32, framecountperbuffer: *mut u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(availabledynamicobjectcount), ::core::mem::transmute(framecountperbuffer)).ok()
}
pub unsafe fn EndUpdatingAudioObjects(&self) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self)).ok()
}
pub unsafe fn ActivateSpatialAudioObjectForMetadataCommands(&self, r#type: AudioObjectType) -> ::windows::core::Result<ISpatialAudioObjectForMetadataCommands> {
let mut result__: <ISpatialAudioObjectForMetadataCommands as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), &mut result__).from_abi::<ISpatialAudioObjectForMetadataCommands>(result__)
}
pub unsafe fn ActivateSpatialAudioObjectForMetadataItems(&self, r#type: AudioObjectType) -> ::windows::core::Result<ISpatialAudioObjectForMetadataItems> {
let mut result__: <ISpatialAudioObjectForMetadataItems as ::windows::core::Abi>::Abi = ::core::mem::zeroed();
(::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), &mut result__).from_abi::<ISpatialAudioObjectForMetadataItems>(result__)
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectRenderStreamForMetadata {
type Vtable = ISpatialAudioObjectRenderStreamForMetadata_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbbc9c907_48d5_4a2e_a0c7_f7f0d67c1fb1);
}
impl ::core::convert::From<ISpatialAudioObjectRenderStreamForMetadata> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectRenderStreamForMetadata) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectRenderStreamForMetadata> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectRenderStreamForMetadata) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectRenderStreamForMetadata {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectRenderStreamForMetadata {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
impl ::core::convert::From<ISpatialAudioObjectRenderStreamForMetadata> for ISpatialAudioObjectRenderStreamBase {
fn from(value: ISpatialAudioObjectRenderStreamForMetadata) -> Self {
unsafe { ::core::mem::transmute(value) }
}
}
impl ::core::convert::From<&ISpatialAudioObjectRenderStreamForMetadata> for ISpatialAudioObjectRenderStreamBase {
fn from(value: &ISpatialAudioObjectRenderStreamForMetadata) -> Self {
::core::convert::From::from(::core::clone::Clone::clone(value))
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectRenderStreamBase> for ISpatialAudioObjectRenderStreamForMetadata {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectRenderStreamBase> {
::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) })
}
}
impl<'a> ::windows::core::IntoParam<'a, ISpatialAudioObjectRenderStreamBase> for &ISpatialAudioObjectRenderStreamForMetadata {
fn into_param(self) -> ::windows::core::Param<'a, ISpatialAudioObjectRenderStreamBase> {
::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) })
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectRenderStreamForMetadata_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, riid: *const ::windows::core::GUID, service: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, availabledynamicobjectcount: *mut u32, framecountperbuffer: *mut u32) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: AudioObjectType, audioobject: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: AudioObjectType, audioobject: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISpatialAudioObjectRenderStreamNotify(pub ::windows::core::IUnknown);
impl ISpatialAudioObjectRenderStreamNotify {
pub unsafe fn OnAvailableDynamicObjectCountChange<'a, Param0: ::windows::core::IntoParam<'a, ISpatialAudioObjectRenderStreamBase>>(&self, sender: Param0, hnscompliancedeadlinetime: i64, availabledynamicobjectcountchange: u32) -> ::windows::core::Result<()> {
(::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), sender.into_param().abi(), ::core::mem::transmute(hnscompliancedeadlinetime), ::core::mem::transmute(availabledynamicobjectcountchange)).ok()
}
}
unsafe impl ::windows::core::Interface for ISpatialAudioObjectRenderStreamNotify {
type Vtable = ISpatialAudioObjectRenderStreamNotify_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdddf83e6_68d7_4c70_883f_a1836afb4a50);
}
impl ::core::convert::From<ISpatialAudioObjectRenderStreamNotify> for ::windows::core::IUnknown {
fn from(value: ISpatialAudioObjectRenderStreamNotify) -> Self {
value.0
}
}
impl ::core::convert::From<&ISpatialAudioObjectRenderStreamNotify> for ::windows::core::IUnknown {
fn from(value: &ISpatialAudioObjectRenderStreamNotify) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISpatialAudioObjectRenderStreamNotify {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISpatialAudioObjectRenderStreamNotify {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISpatialAudioObjectRenderStreamNotify_abi(
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32,
pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, hnscompliancedeadlinetime: i64, availabledynamicobjectcountchange: u32) -> ::windows::core::HRESULT,
);
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct ISubunit(pub ::windows::core::IUnknown);
impl ISubunit {}
unsafe impl ::windows::core::Interface for ISubunit {
type Vtable = ISubunit_abi;
const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x82149a85_dba6_4487_86bb_ea8f7fefcc71);
}
impl ::core::convert::From<ISubunit> for ::windows::core::IUnknown {
fn from(value: ISubunit) -> Self {
value.0
}
}
impl ::core::convert::From<&ISubunit> for ::windows::core::IUnknown {
fn from(value: &ISubunit) -> Self {
value.0.clone()
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISubunit {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Owned(self.0)
}
}
impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISubunit {
fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> {
::windows::core::Param::Borrowed(&self.0)
}
}
#[repr(C)]
#[doc(hidden)]
pub struct ISubunit_abi(pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32);
#[cfg(feature = "Win32_Foundation")]
pub type LPACMDRIVERPROC = unsafe extern "system" fn(param0: usize, param1: HACMDRIVERID, param2: u32, param3: super::super::Foundation::LPARAM, param4: super::super::Foundation::LPARAM) -> super::super::Foundation::LRESULT;
#[cfg(feature = "Win32_Media_Multimedia")]
pub type LPMIDICALLBACK = unsafe extern "system" fn(hdrvr: super::Multimedia::HDRVR, umsg: u32, dwuser: usize, dw1: usize, dw2: usize);
#[cfg(feature = "Win32_Media_Multimedia")]
pub type LPWAVECALLBACK = unsafe extern "system" fn(hdrvr: super::Multimedia::HDRVR, umsg: u32, dwuser: usize, dw1: usize, dw2: usize);
pub const MEVT_F_CALLBACK: i32 = 1073741824i32;
pub const MEVT_F_LONG: i32 = -2147483648i32;
pub const MEVT_F_SHORT: i32 = 0i32;
pub const MHDR_DONE: u32 = 1u32;
pub const MHDR_INQUEUE: u32 = 4u32;
pub const MHDR_ISSTRM: u32 = 8u32;
pub const MHDR_PREPARED: u32 = 2u32;
pub const MIDICAPS_CACHE: u32 = 4u32;
pub const MIDICAPS_LRVOLUME: u32 = 2u32;
pub const MIDICAPS_STREAM: u32 = 8u32;
pub const MIDICAPS_VOLUME: u32 = 1u32;
pub const MIDIERR_BADOPENMODE: u32 = 70u32;
pub const MIDIERR_DONT_CONTINUE: u32 = 71u32;
pub const MIDIERR_INVALIDSETUP: u32 = 69u32;
pub const MIDIERR_LASTERROR: u32 = 71u32;
pub const MIDIERR_NODEVICE: u32 = 68u32;
pub const MIDIERR_NOMAP: u32 = 66u32;
pub const MIDIERR_NOTREADY: u32 = 67u32;
pub const MIDIERR_STILLPLAYING: u32 = 65u32;
pub const MIDIERR_UNPREPARED: u32 = 64u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIDIEVENT {
pub dwDeltaTime: u32,
pub dwStreamID: u32,
pub dwEvent: u32,
pub dwParms: [u32; 1],
}
impl MIDIEVENT {}
impl ::core::default::Default for MIDIEVENT {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIDIEVENT {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIDIEVENT {}
unsafe impl ::windows::core::Abi for MIDIEVENT {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIDIHDR {
pub lpData: super::super::Foundation::PSTR,
pub dwBufferLength: u32,
pub dwBytesRecorded: u32,
pub dwUser: usize,
pub dwFlags: u32,
pub lpNext: *mut MIDIHDR,
pub reserved: usize,
pub dwOffset: u32,
pub dwReserved: [usize; 8],
}
#[cfg(feature = "Win32_Foundation")]
impl MIDIHDR {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIDIHDR {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIDIHDR {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIDIHDR {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIDIHDR {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIDIINCAPS2A {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub dwSupport: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
#[cfg(feature = "Win32_Foundation")]
impl MIDIINCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIDIINCAPS2A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIDIINCAPS2A {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIDIINCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIDIINCAPS2A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIDIINCAPS2W {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub dwSupport: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
impl MIDIINCAPS2W {}
impl ::core::default::Default for MIDIINCAPS2W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIDIINCAPS2W {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIDIINCAPS2W {}
unsafe impl ::windows::core::Abi for MIDIINCAPS2W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIDIINCAPSA {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub dwSupport: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl MIDIINCAPSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIDIINCAPSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIDIINCAPSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIDIINCAPSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIDIINCAPSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIDIINCAPSW {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub dwSupport: u32,
}
impl MIDIINCAPSW {}
impl ::core::default::Default for MIDIINCAPSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIDIINCAPSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIDIINCAPSW {}
unsafe impl ::windows::core::Abi for MIDIINCAPSW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIDIOUTCAPS2A {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub wTechnology: u16,
pub wVoices: u16,
pub wNotes: u16,
pub wChannelMask: u16,
pub dwSupport: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
#[cfg(feature = "Win32_Foundation")]
impl MIDIOUTCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIDIOUTCAPS2A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIDIOUTCAPS2A {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIDIOUTCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIDIOUTCAPS2A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIDIOUTCAPS2W {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub wTechnology: u16,
pub wVoices: u16,
pub wNotes: u16,
pub wChannelMask: u16,
pub dwSupport: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
impl MIDIOUTCAPS2W {}
impl ::core::default::Default for MIDIOUTCAPS2W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIDIOUTCAPS2W {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIDIOUTCAPS2W {}
unsafe impl ::windows::core::Abi for MIDIOUTCAPS2W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIDIOUTCAPSA {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub wTechnology: u16,
pub wVoices: u16,
pub wNotes: u16,
pub wChannelMask: u16,
pub dwSupport: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl MIDIOUTCAPSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIDIOUTCAPSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIDIOUTCAPSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIDIOUTCAPSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIDIOUTCAPSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIDIOUTCAPSW {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub wTechnology: u16,
pub wVoices: u16,
pub wNotes: u16,
pub wChannelMask: u16,
pub dwSupport: u32,
}
impl MIDIOUTCAPSW {}
impl ::core::default::Default for MIDIOUTCAPSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIDIOUTCAPSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIDIOUTCAPSW {}
unsafe impl ::windows::core::Abi for MIDIOUTCAPSW {
type Abi = Self;
}
pub const MIDIPATCHSIZE: u32 = 128u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIDIPROPTEMPO {
pub cbStruct: u32,
pub dwTempo: u32,
}
impl MIDIPROPTEMPO {}
impl ::core::default::Default for MIDIPROPTEMPO {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIDIPROPTEMPO {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIDIPROPTEMPO {}
unsafe impl ::windows::core::Abi for MIDIPROPTEMPO {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIDIPROPTIMEDIV {
pub cbStruct: u32,
pub dwTimeDiv: u32,
}
impl MIDIPROPTIMEDIV {}
impl ::core::default::Default for MIDIPROPTIMEDIV {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIDIPROPTIMEDIV {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIDIPROPTIMEDIV {}
unsafe impl ::windows::core::Abi for MIDIPROPTIMEDIV {
type Abi = Self;
}
pub const MIDIPROP_GET: i32 = 1073741824i32;
pub const MIDIPROP_SET: i32 = -2147483648i32;
pub const MIDIPROP_TEMPO: i32 = 2i32;
pub const MIDIPROP_TIMEDIV: i32 = 1i32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIDISTRMBUFFVER {
pub dwVersion: u32,
pub dwMid: u32,
pub dwOEMVersion: u32,
}
impl MIDISTRMBUFFVER {}
impl ::core::default::Default for MIDISTRMBUFFVER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIDISTRMBUFFVER {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIDISTRMBUFFVER {}
unsafe impl ::windows::core::Abi for MIDISTRMBUFFVER {
type Abi = Self;
}
pub const MIDISTRM_ERROR: i32 = -2i32;
pub const MIDI_CACHE_ALL: u32 = 1u32;
pub const MIDI_CACHE_BESTFIT: u32 = 2u32;
pub const MIDI_CACHE_QUERY: u32 = 3u32;
pub const MIDI_UNCACHE: u32 = 4u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct MIDI_WAVE_OPEN_TYPE(pub u32);
pub const CALLBACK_TYPEMASK: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(458752u32);
pub const CALLBACK_NULL: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(0u32);
pub const CALLBACK_WINDOW: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(65536u32);
pub const CALLBACK_TASK: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(131072u32);
pub const CALLBACK_FUNCTION: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(196608u32);
pub const CALLBACK_THREAD: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(131072u32);
pub const CALLBACK_EVENT: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(327680u32);
pub const WAVE_FORMAT_QUERY: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(1u32);
pub const WAVE_ALLOWSYNC: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(2u32);
pub const WAVE_MAPPED: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(4u32);
pub const WAVE_FORMAT_DIRECT: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(8u32);
pub const WAVE_FORMAT_DIRECT_QUERY: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(9u32);
pub const WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(16u32);
pub const MIDI_IO_STATUS: MIDI_WAVE_OPEN_TYPE = MIDI_WAVE_OPEN_TYPE(32u32);
impl ::core::convert::From<u32> for MIDI_WAVE_OPEN_TYPE {
fn from(value: u32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for MIDI_WAVE_OPEN_TYPE {
type Abi = Self;
}
impl ::core::ops::BitOr for MIDI_WAVE_OPEN_TYPE {
type Output = Self;
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
}
impl ::core::ops::BitAnd for MIDI_WAVE_OPEN_TYPE {
type Output = Self;
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
}
impl ::core::ops::BitOrAssign for MIDI_WAVE_OPEN_TYPE {
fn bitor_assign(&mut self, rhs: Self) {
self.0.bitor_assign(rhs.0)
}
}
impl ::core::ops::BitAndAssign for MIDI_WAVE_OPEN_TYPE {
fn bitand_assign(&mut self, rhs: Self) {
self.0.bitand_assign(rhs.0)
}
}
impl ::core::ops::Not for MIDI_WAVE_OPEN_TYPE {
type Output = Self;
fn not(self) -> Self {
Self(self.0.not())
}
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERCAPS2A {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub fdwSupport: u32,
pub cDestinations: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCAPS2A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCAPS2A {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCAPS2A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCAPS2W {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub fdwSupport: u32,
pub cDestinations: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
impl MIXERCAPS2W {}
impl ::core::default::Default for MIXERCAPS2W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCAPS2W {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCAPS2W {}
unsafe impl ::windows::core::Abi for MIXERCAPS2W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERCAPSA {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub fdwSupport: u32,
pub cDestinations: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCAPSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCAPSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCAPSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCAPSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCAPSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCAPSW {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub fdwSupport: u32,
pub cDestinations: u32,
}
impl MIXERCAPSW {}
impl ::core::default::Default for MIXERCAPSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCAPSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCAPSW {}
unsafe impl ::windows::core::Abi for MIXERCAPSW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERCONTROLA {
pub cbStruct: u32,
pub dwControlID: u32,
pub dwControlType: u32,
pub fdwControl: u32,
pub cMultipleItems: u32,
pub szShortName: [super::super::Foundation::CHAR; 16],
pub szName: [super::super::Foundation::CHAR; 64],
pub Bounds: MIXERCONTROLA_0,
pub Metrics: MIXERCONTROLA_1,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCONTROLA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCONTROLA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCONTROLA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCONTROLA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCONTROLA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub union MIXERCONTROLA_0 {
pub Anonymous1: MIXERCONTROLA_0_0,
pub Anonymous2: MIXERCONTROLA_0_1,
pub dwReserved: [u32; 6],
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCONTROLA_0 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCONTROLA_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCONTROLA_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCONTROLA_0 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCONTROLA_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERCONTROLA_0_0 {
pub lMinimum: i32,
pub lMaximum: i32,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCONTROLA_0_0 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCONTROLA_0_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCONTROLA_0_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCONTROLA_0_0 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCONTROLA_0_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERCONTROLA_0_1 {
pub dwMinimum: u32,
pub dwMaximum: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCONTROLA_0_1 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCONTROLA_0_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCONTROLA_0_1 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCONTROLA_0_1 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCONTROLA_0_1 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub union MIXERCONTROLA_1 {
pub cSteps: u32,
pub cbCustomData: u32,
pub dwReserved: [u32; 6],
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCONTROLA_1 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCONTROLA_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCONTROLA_1 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCONTROLA_1 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCONTROLA_1 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERCONTROLDETAILS {
pub cbStruct: u32,
pub dwControlID: u32,
pub cChannels: u32,
pub Anonymous: MIXERCONTROLDETAILS_0,
pub cbDetails: u32,
pub paDetails: *mut ::core::ffi::c_void,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCONTROLDETAILS {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCONTROLDETAILS {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCONTROLDETAILS {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCONTROLDETAILS {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCONTROLDETAILS {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub union MIXERCONTROLDETAILS_0 {
pub hwndOwner: super::super::Foundation::HWND,
pub cMultipleItems: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCONTROLDETAILS_0 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCONTROLDETAILS_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCONTROLDETAILS_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCONTROLDETAILS_0 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCONTROLDETAILS_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCONTROLDETAILS_BOOLEAN {
pub fValue: i32,
}
impl MIXERCONTROLDETAILS_BOOLEAN {}
impl ::core::default::Default for MIXERCONTROLDETAILS_BOOLEAN {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLDETAILS_BOOLEAN {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLDETAILS_BOOLEAN {}
unsafe impl ::windows::core::Abi for MIXERCONTROLDETAILS_BOOLEAN {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERCONTROLDETAILS_LISTTEXTA {
pub dwParam1: u32,
pub dwParam2: u32,
pub szName: [super::super::Foundation::CHAR; 64],
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERCONTROLDETAILS_LISTTEXTA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERCONTROLDETAILS_LISTTEXTA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERCONTROLDETAILS_LISTTEXTA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERCONTROLDETAILS_LISTTEXTA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERCONTROLDETAILS_LISTTEXTA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCONTROLDETAILS_LISTTEXTW {
pub dwParam1: u32,
pub dwParam2: u32,
pub szName: [u16; 64],
}
impl MIXERCONTROLDETAILS_LISTTEXTW {}
impl ::core::default::Default for MIXERCONTROLDETAILS_LISTTEXTW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLDETAILS_LISTTEXTW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLDETAILS_LISTTEXTW {}
unsafe impl ::windows::core::Abi for MIXERCONTROLDETAILS_LISTTEXTW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCONTROLDETAILS_SIGNED {
pub lValue: i32,
}
impl MIXERCONTROLDETAILS_SIGNED {}
impl ::core::default::Default for MIXERCONTROLDETAILS_SIGNED {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLDETAILS_SIGNED {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLDETAILS_SIGNED {}
unsafe impl ::windows::core::Abi for MIXERCONTROLDETAILS_SIGNED {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCONTROLDETAILS_UNSIGNED {
pub dwValue: u32,
}
impl MIXERCONTROLDETAILS_UNSIGNED {}
impl ::core::default::Default for MIXERCONTROLDETAILS_UNSIGNED {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLDETAILS_UNSIGNED {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLDETAILS_UNSIGNED {}
unsafe impl ::windows::core::Abi for MIXERCONTROLDETAILS_UNSIGNED {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCONTROLW {
pub cbStruct: u32,
pub dwControlID: u32,
pub dwControlType: u32,
pub fdwControl: u32,
pub cMultipleItems: u32,
pub szShortName: [u16; 16],
pub szName: [u16; 64],
pub Bounds: MIXERCONTROLW_0,
pub Metrics: MIXERCONTROLW_1,
}
impl MIXERCONTROLW {}
impl ::core::default::Default for MIXERCONTROLW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLW {}
unsafe impl ::windows::core::Abi for MIXERCONTROLW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub union MIXERCONTROLW_0 {
pub Anonymous1: MIXERCONTROLW_0_0,
pub Anonymous2: MIXERCONTROLW_0_1,
pub dwReserved: [u32; 6],
}
impl MIXERCONTROLW_0 {}
impl ::core::default::Default for MIXERCONTROLW_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLW_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLW_0 {}
unsafe impl ::windows::core::Abi for MIXERCONTROLW_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCONTROLW_0_0 {
pub lMinimum: i32,
pub lMaximum: i32,
}
impl MIXERCONTROLW_0_0 {}
impl ::core::default::Default for MIXERCONTROLW_0_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLW_0_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLW_0_0 {}
unsafe impl ::windows::core::Abi for MIXERCONTROLW_0_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERCONTROLW_0_1 {
pub dwMinimum: u32,
pub dwMaximum: u32,
}
impl MIXERCONTROLW_0_1 {}
impl ::core::default::Default for MIXERCONTROLW_0_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLW_0_1 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLW_0_1 {}
unsafe impl ::windows::core::Abi for MIXERCONTROLW_0_1 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub union MIXERCONTROLW_1 {
pub cSteps: u32,
pub cbCustomData: u32,
pub dwReserved: [u32; 6],
}
impl MIXERCONTROLW_1 {}
impl ::core::default::Default for MIXERCONTROLW_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERCONTROLW_1 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERCONTROLW_1 {}
unsafe impl ::windows::core::Abi for MIXERCONTROLW_1 {
type Abi = Self;
}
pub const MIXERCONTROL_CONTROLF_DISABLED: i32 = -2147483648i32;
pub const MIXERCONTROL_CONTROLF_MULTIPLE: i32 = 2i32;
pub const MIXERCONTROL_CONTROLF_UNIFORM: i32 = 1i32;
pub const MIXERCONTROL_CONTROLTYPE_BASS: u32 = 1342373890u32;
pub const MIXERCONTROL_CONTROLTYPE_BASS_BOOST: u32 = 536945271u32;
pub const MIXERCONTROL_CONTROLTYPE_BOOLEAN: u32 = 536936448u32;
pub const MIXERCONTROL_CONTROLTYPE_BOOLEANMETER: u32 = 268500992u32;
pub const MIXERCONTROL_CONTROLTYPE_BUTTON: u32 = 553713664u32;
pub const MIXERCONTROL_CONTROLTYPE_CUSTOM: u32 = 0u32;
pub const MIXERCONTROL_CONTROLTYPE_DECIBELS: u32 = 805568512u32;
pub const MIXERCONTROL_CONTROLTYPE_EQUALIZER: u32 = 1342373892u32;
pub const MIXERCONTROL_CONTROLTYPE_FADER: u32 = 1342373888u32;
pub const MIXERCONTROL_CONTROLTYPE_LOUDNESS: u32 = 536936452u32;
pub const MIXERCONTROL_CONTROLTYPE_MICROTIME: u32 = 1610809344u32;
pub const MIXERCONTROL_CONTROLTYPE_MILLITIME: u32 = 1627586560u32;
pub const MIXERCONTROL_CONTROLTYPE_MIXER: u32 = 1895890945u32;
pub const MIXERCONTROL_CONTROLTYPE_MONO: u32 = 536936451u32;
pub const MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT: u32 = 1895890944u32;
pub const MIXERCONTROL_CONTROLTYPE_MUTE: u32 = 536936450u32;
pub const MIXERCONTROL_CONTROLTYPE_MUX: u32 = 1879113729u32;
pub const MIXERCONTROL_CONTROLTYPE_ONOFF: u32 = 536936449u32;
pub const MIXERCONTROL_CONTROLTYPE_PAN: u32 = 1073872897u32;
pub const MIXERCONTROL_CONTROLTYPE_PEAKMETER: u32 = 268566529u32;
pub const MIXERCONTROL_CONTROLTYPE_PERCENT: u32 = 805634048u32;
pub const MIXERCONTROL_CONTROLTYPE_QSOUNDPAN: u32 = 1073872898u32;
pub const MIXERCONTROL_CONTROLTYPE_SIGNED: u32 = 805437440u32;
pub const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER: u32 = 268566528u32;
pub const MIXERCONTROL_CONTROLTYPE_SINGLESELECT: u32 = 1879113728u32;
pub const MIXERCONTROL_CONTROLTYPE_SLIDER: u32 = 1073872896u32;
pub const MIXERCONTROL_CONTROLTYPE_STEREOENH: u32 = 536936453u32;
pub const MIXERCONTROL_CONTROLTYPE_TREBLE: u32 = 1342373891u32;
pub const MIXERCONTROL_CONTROLTYPE_UNSIGNED: u32 = 805502976u32;
pub const MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER: u32 = 268632064u32;
pub const MIXERCONTROL_CONTROLTYPE_VOLUME: u32 = 1342373889u32;
pub const MIXERCONTROL_CT_CLASS_CUSTOM: i32 = 0i32;
pub const MIXERCONTROL_CT_CLASS_FADER: i32 = 1342177280i32;
pub const MIXERCONTROL_CT_CLASS_LIST: i32 = 1879048192i32;
pub const MIXERCONTROL_CT_CLASS_MASK: i32 = -268435456i32;
pub const MIXERCONTROL_CT_CLASS_METER: i32 = 268435456i32;
pub const MIXERCONTROL_CT_CLASS_NUMBER: i32 = 805306368i32;
pub const MIXERCONTROL_CT_CLASS_SLIDER: i32 = 1073741824i32;
pub const MIXERCONTROL_CT_CLASS_SWITCH: i32 = 536870912i32;
pub const MIXERCONTROL_CT_CLASS_TIME: i32 = 1610612736i32;
pub const MIXERCONTROL_CT_SC_LIST_MULTIPLE: i32 = 16777216i32;
pub const MIXERCONTROL_CT_SC_LIST_SINGLE: i32 = 0i32;
pub const MIXERCONTROL_CT_SC_METER_POLLED: i32 = 0i32;
pub const MIXERCONTROL_CT_SC_SWITCH_BOOLEAN: i32 = 0i32;
pub const MIXERCONTROL_CT_SC_SWITCH_BUTTON: i32 = 16777216i32;
pub const MIXERCONTROL_CT_SC_TIME_MICROSECS: i32 = 0i32;
pub const MIXERCONTROL_CT_SC_TIME_MILLISECS: i32 = 16777216i32;
pub const MIXERCONTROL_CT_SUBCLASS_MASK: i32 = 251658240i32;
pub const MIXERCONTROL_CT_UNITS_BOOLEAN: i32 = 65536i32;
pub const MIXERCONTROL_CT_UNITS_CUSTOM: i32 = 0i32;
pub const MIXERCONTROL_CT_UNITS_DECIBELS: i32 = 262144i32;
pub const MIXERCONTROL_CT_UNITS_MASK: i32 = 16711680i32;
pub const MIXERCONTROL_CT_UNITS_PERCENT: i32 = 327680i32;
pub const MIXERCONTROL_CT_UNITS_SIGNED: i32 = 131072i32;
pub const MIXERCONTROL_CT_UNITS_UNSIGNED: i32 = 196608i32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERLINEA {
pub cbStruct: u32,
pub dwDestination: u32,
pub dwSource: u32,
pub dwLineID: u32,
pub fdwLine: u32,
pub dwUser: usize,
pub dwComponentType: MIXERLINE_COMPONENTTYPE,
pub cChannels: u32,
pub cConnections: u32,
pub cControls: u32,
pub szShortName: [super::super::Foundation::CHAR; 16],
pub szName: [super::super::Foundation::CHAR; 64],
pub Target: MIXERLINEA_0,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERLINEA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERLINEA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERLINEA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERLINEA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERLINEA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERLINEA_0 {
pub dwType: u32,
pub dwDeviceID: u32,
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERLINEA_0 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERLINEA_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERLINEA_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERLINEA_0 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERLINEA_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct MIXERLINECONTROLSA {
pub cbStruct: u32,
pub dwLineID: u32,
pub Anonymous: MIXERLINECONTROLSA_0,
pub cControls: u32,
pub cbmxctrl: u32,
pub pamxctrl: *mut MIXERCONTROLA,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERLINECONTROLSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERLINECONTROLSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERLINECONTROLSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERLINECONTROLSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERLINECONTROLSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub union MIXERLINECONTROLSA_0 {
pub dwControlID: u32,
pub dwControlType: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl MIXERLINECONTROLSA_0 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for MIXERLINECONTROLSA_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for MIXERLINECONTROLSA_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for MIXERLINECONTROLSA_0 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for MIXERLINECONTROLSA_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERLINECONTROLSW {
pub cbStruct: u32,
pub dwLineID: u32,
pub Anonymous: MIXERLINECONTROLSW_0,
pub cControls: u32,
pub cbmxctrl: u32,
pub pamxctrl: *mut MIXERCONTROLW,
}
impl MIXERLINECONTROLSW {}
impl ::core::default::Default for MIXERLINECONTROLSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERLINECONTROLSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERLINECONTROLSW {}
unsafe impl ::windows::core::Abi for MIXERLINECONTROLSW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub union MIXERLINECONTROLSW_0 {
pub dwControlID: u32,
pub dwControlType: u32,
}
impl MIXERLINECONTROLSW_0 {}
impl ::core::default::Default for MIXERLINECONTROLSW_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERLINECONTROLSW_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERLINECONTROLSW_0 {}
unsafe impl ::windows::core::Abi for MIXERLINECONTROLSW_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERLINEW {
pub cbStruct: u32,
pub dwDestination: u32,
pub dwSource: u32,
pub dwLineID: u32,
pub fdwLine: u32,
pub dwUser: usize,
pub dwComponentType: MIXERLINE_COMPONENTTYPE,
pub cChannels: u32,
pub cConnections: u32,
pub cControls: u32,
pub szShortName: [u16; 16],
pub szName: [u16; 64],
pub Target: MIXERLINEW_0,
}
impl MIXERLINEW {}
impl ::core::default::Default for MIXERLINEW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERLINEW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERLINEW {}
unsafe impl ::windows::core::Abi for MIXERLINEW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct MIXERLINEW_0 {
pub dwType: u32,
pub dwDeviceID: u32,
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
}
impl MIXERLINEW_0 {}
impl ::core::default::Default for MIXERLINEW_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for MIXERLINEW_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for MIXERLINEW_0 {}
unsafe impl ::windows::core::Abi for MIXERLINEW_0 {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct MIXERLINE_COMPONENTTYPE(pub u32);
pub const MIXERLINE_COMPONENTTYPE_DST_DIGITAL: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(1u32);
pub const MIXERLINE_COMPONENTTYPE_DST_HEADPHONES: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(5u32);
pub const MIXERLINE_COMPONENTTYPE_DST_LINE: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(2u32);
pub const MIXERLINE_COMPONENTTYPE_DST_MONITOR: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(3u32);
pub const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4u32);
pub const MIXERLINE_COMPONENTTYPE_DST_TELEPHONE: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(6u32);
pub const MIXERLINE_COMPONENTTYPE_DST_UNDEFINED: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(0u32);
pub const MIXERLINE_COMPONENTTYPE_DST_VOICEIN: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(8u32);
pub const MIXERLINE_COMPONENTTYPE_DST_WAVEIN: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(7u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_ANALOG: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4106u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4105u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4101u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_DIGITAL: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4097u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_LINE: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4098u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4099u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4103u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4100u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4102u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4096u32);
pub const MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT: MIXERLINE_COMPONENTTYPE = MIXERLINE_COMPONENTTYPE(4104u32);
impl ::core::convert::From<u32> for MIXERLINE_COMPONENTTYPE {
fn from(value: u32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for MIXERLINE_COMPONENTTYPE {
type Abi = Self;
}
impl ::core::ops::BitOr for MIXERLINE_COMPONENTTYPE {
type Output = Self;
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
}
impl ::core::ops::BitAnd for MIXERLINE_COMPONENTTYPE {
type Output = Self;
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
}
impl ::core::ops::BitOrAssign for MIXERLINE_COMPONENTTYPE {
fn bitor_assign(&mut self, rhs: Self) {
self.0.bitor_assign(rhs.0)
}
}
impl ::core::ops::BitAndAssign for MIXERLINE_COMPONENTTYPE {
fn bitand_assign(&mut self, rhs: Self) {
self.0.bitand_assign(rhs.0)
}
}
impl ::core::ops::Not for MIXERLINE_COMPONENTTYPE {
type Output = Self;
fn not(self) -> Self {
Self(self.0.not())
}
}
pub const MIXERLINE_COMPONENTTYPE_DST_FIRST: i32 = 0i32;
pub const MIXERLINE_COMPONENTTYPE_DST_LAST: u32 = 8u32;
pub const MIXERLINE_COMPONENTTYPE_SRC_FIRST: i32 = 4096i32;
pub const MIXERLINE_COMPONENTTYPE_SRC_LAST: u32 = 4106u32;
pub const MIXERLINE_LINEF_ACTIVE: i32 = 1i32;
pub const MIXERLINE_LINEF_DISCONNECTED: i32 = 32768i32;
pub const MIXERLINE_LINEF_SOURCE: i32 = -2147483648i32;
pub const MIXERLINE_TARGETTYPE_AUX: u32 = 5u32;
pub const MIXERLINE_TARGETTYPE_MIDIIN: u32 = 4u32;
pub const MIXERLINE_TARGETTYPE_MIDIOUT: u32 = 3u32;
pub const MIXERLINE_TARGETTYPE_UNDEFINED: u32 = 0u32;
pub const MIXERLINE_TARGETTYPE_WAVEIN: u32 = 2u32;
pub const MIXERLINE_TARGETTYPE_WAVEOUT: u32 = 1u32;
pub const MIXERR_INVALCONTROL: u32 = 1025u32;
pub const MIXERR_INVALLINE: u32 = 1024u32;
pub const MIXERR_INVALVALUE: u32 = 1026u32;
pub const MIXERR_LASTERROR: u32 = 1026u32;
pub const MIXER_GETCONTROLDETAILSF_LISTTEXT: i32 = 1i32;
pub const MIXER_GETCONTROLDETAILSF_QUERYMASK: i32 = 15i32;
pub const MIXER_GETCONTROLDETAILSF_VALUE: i32 = 0i32;
pub const MIXER_GETLINECONTROLSF_ALL: i32 = 0i32;
pub const MIXER_GETLINECONTROLSF_ONEBYID: i32 = 1i32;
pub const MIXER_GETLINECONTROLSF_ONEBYTYPE: i32 = 2i32;
pub const MIXER_GETLINECONTROLSF_QUERYMASK: i32 = 15i32;
pub const MIXER_GETLINEINFOF_COMPONENTTYPE: i32 = 3i32;
pub const MIXER_GETLINEINFOF_DESTINATION: i32 = 0i32;
pub const MIXER_GETLINEINFOF_LINEID: i32 = 2i32;
pub const MIXER_GETLINEINFOF_QUERYMASK: i32 = 15i32;
pub const MIXER_GETLINEINFOF_SOURCE: i32 = 1i32;
pub const MIXER_GETLINEINFOF_TARGETTYPE: i32 = 4i32;
pub const MIXER_LONG_NAME_CHARS: u32 = 64u32;
pub const MIXER_OBJECTF_AUX: i32 = 1342177280i32;
pub const MIXER_OBJECTF_HANDLE: i32 = -2147483648i32;
pub const MIXER_OBJECTF_MIDIIN: i32 = 1073741824i32;
pub const MIXER_OBJECTF_MIDIOUT: i32 = 805306368i32;
pub const MIXER_OBJECTF_MIXER: i32 = 0i32;
pub const MIXER_OBJECTF_WAVEIN: i32 = 536870912i32;
pub const MIXER_OBJECTF_WAVEOUT: i32 = 268435456i32;
pub const MIXER_SETCONTROLDETAILSF_CUSTOM: i32 = 1i32;
pub const MIXER_SETCONTROLDETAILSF_QUERYMASK: i32 = 15i32;
pub const MIXER_SETCONTROLDETAILSF_VALUE: i32 = 0i32;
pub const MIXER_SHORT_NAME_CHARS: u32 = 16u32;
pub const MMDeviceEnumerator: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbcde0395_e52f_467c_8e3d_c4579291692e);
pub const MM_ACM_FILTERCHOOSE: u32 = 32768u32;
pub const MM_ACM_FORMATCHOOSE: u32 = 32768u32;
pub const MOD_FMSYNTH: u32 = 4u32;
pub const MOD_MAPPER: u32 = 5u32;
pub const MOD_MIDIPORT: u32 = 1u32;
pub const MOD_SQSYNTH: u32 = 3u32;
pub const MOD_SWSYNTH: u32 = 7u32;
pub const MOD_SYNTH: u32 = 2u32;
pub const MOD_WAVETABLE: u32 = 6u32;
pub type PAudioStateMonitorCallback = unsafe extern "system" fn(audiostatemonitor: ::windows::core::RawPtr, context: *const ::core::ffi::c_void);
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct PCMWAVEFORMAT {
pub wf: WAVEFORMAT,
pub wBitsPerSample: u16,
}
impl PCMWAVEFORMAT {}
impl ::core::default::Default for PCMWAVEFORMAT {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for PCMWAVEFORMAT {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for PCMWAVEFORMAT {}
unsafe impl ::windows::core::Abi for PCMWAVEFORMAT {
type Abi = Self;
}
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpointLogo_IconEffects: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0xf1ab780d_2010_4ed3_a3a6_8b87f0f0c476), pid: 0u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpointLogo_IconPath: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0xf1ab780d_2010_4ed3_a3a6_8b87f0f0c476), pid: 1u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpointSettings_LaunchContract: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x14242002_0320_4de4_9555_a7d82b73c286), pid: 1u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpointSettings_MenuText: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x14242002_0320_4de4_9555_a7d82b73c286), pid: 0u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_Association: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 2u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_ControlPanelPageProvider: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 1u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_Default_VolumeInDb: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 9u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_Disable_SysFx: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 5u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_FormFactor: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 0u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_FullRangeSpeakers: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 6u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_GUID: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 4u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_JackSubType: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 8u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_PhysicalSpeakers: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 3u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEndpoint_Supports_EventDriven_Mode: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1da5d803_d492_4edd_8c23_e0c0ffee7f0e), pid: 7u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEngine_DeviceFormat: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0xf19f064d_082c_4e27_bc73_6882a1bb8e4c), pid: 0u32 };
#[cfg(feature = "Win32_UI_Shell_PropertiesSystem")]
pub const PKEY_AudioEngine_OEMFormat: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0xe4870e26_3cc5_4cd2_ba46_ca0a9a70ed04), pid: 3u32 };
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct PROCESS_LOOPBACK_MODE(pub i32);
pub const PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE: PROCESS_LOOPBACK_MODE = PROCESS_LOOPBACK_MODE(0i32);
pub const PROCESS_LOOPBACK_MODE_EXCLUDE_TARGET_PROCESS_TREE: PROCESS_LOOPBACK_MODE = PROCESS_LOOPBACK_MODE(1i32);
impl ::core::convert::From<i32> for PROCESS_LOOPBACK_MODE {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for PROCESS_LOOPBACK_MODE {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct PartType(pub i32);
pub const Connector: PartType = PartType(0i32);
pub const Subunit: PartType = PartType(1i32);
impl ::core::convert::From<i32> for PartType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for PartType {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn PlaySoundA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HINSTANCE>>(pszsound: Param0, hmod: Param1, fdwsound: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn PlaySoundA(pszsound: super::super::Foundation::PSTR, hmod: super::super::Foundation::HINSTANCE, fdwsound: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(PlaySoundA(pszsound.into_param().abi(), hmod.into_param().abi(), ::core::mem::transmute(fdwsound)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn PlaySoundW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HINSTANCE>>(pszsound: Param0, hmod: Param1, fdwsound: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn PlaySoundW(pszsound: super::super::Foundation::PWSTR, hmod: super::super::Foundation::HINSTANCE, fdwsound: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(PlaySoundW(pszsound.into_param().abi(), hmod.into_param().abi(), ::core::mem::transmute(fdwsound)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
pub const SND_ALIAS: i32 = 65536i32;
pub const SND_ALIAS_ID: i32 = 1114112i32;
pub const SND_ALIAS_START: u32 = 0u32;
pub const SND_APPLICATION: u32 = 128u32;
pub const SND_ASYNC: u32 = 1u32;
pub const SND_FILENAME: i32 = 131072i32;
pub const SND_LOOP: u32 = 8u32;
pub const SND_MEMORY: u32 = 4u32;
pub const SND_NODEFAULT: u32 = 2u32;
pub const SND_NOSTOP: u32 = 16u32;
pub const SND_NOWAIT: i32 = 8192i32;
pub const SND_PURGE: u32 = 64u32;
pub const SND_RESOURCE: i32 = 262148i32;
pub const SND_RING: i32 = 1048576i32;
pub const SND_SENTRY: i32 = 524288i32;
pub const SND_SYNC: u32 = 0u32;
pub const SND_SYSTEM: i32 = 2097152i32;
pub const SPATIAL_AUDIO_POSITION: u32 = 200u32;
pub const SPATIAL_AUDIO_STANDARD_COMMANDS_START: u32 = 200u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SPATIAL_AUDIO_STREAM_OPTIONS(pub u32);
pub const SPATIAL_AUDIO_STREAM_OPTIONS_NONE: SPATIAL_AUDIO_STREAM_OPTIONS = SPATIAL_AUDIO_STREAM_OPTIONS(0u32);
pub const SPATIAL_AUDIO_STREAM_OPTIONS_OFFLOAD: SPATIAL_AUDIO_STREAM_OPTIONS = SPATIAL_AUDIO_STREAM_OPTIONS(1u32);
impl ::core::convert::From<u32> for SPATIAL_AUDIO_STREAM_OPTIONS {
fn from(value: u32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SPATIAL_AUDIO_STREAM_OPTIONS {
type Abi = Self;
}
impl ::core::ops::BitOr for SPATIAL_AUDIO_STREAM_OPTIONS {
type Output = Self;
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
}
impl ::core::ops::BitAnd for SPATIAL_AUDIO_STREAM_OPTIONS {
type Output = Self;
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
}
impl ::core::ops::BitOrAssign for SPATIAL_AUDIO_STREAM_OPTIONS {
fn bitor_assign(&mut self, rhs: Self) {
self.0.bitor_assign(rhs.0)
}
}
impl ::core::ops::BitAndAssign for SPATIAL_AUDIO_STREAM_OPTIONS {
fn bitand_assign(&mut self, rhs: Self) {
self.0.bitand_assign(rhs.0)
}
}
impl ::core::ops::Not for SPATIAL_AUDIO_STREAM_OPTIONS {
type Output = Self;
fn not(self) -> Self {
Self(self.0.not())
}
}
pub const SPTLAUDCLNT_E_DESTROYED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287232i32 as _);
pub const SPTLAUDCLNT_E_ERRORS_IN_OBJECT_CALLS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287227i32 as _);
pub const SPTLAUDCLNT_E_INTERNAL: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287219i32 as _);
pub const SPTLAUDCLNT_E_INVALID_LICENSE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287224i32 as _);
pub const SPTLAUDCLNT_E_METADATA_FORMAT_NOT_SUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287226i32 as _);
pub const SPTLAUDCLNT_E_NO_MORE_OBJECTS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287229i32 as _);
pub const SPTLAUDCLNT_E_OBJECT_ALREADY_ACTIVE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287220i32 as _);
pub const SPTLAUDCLNT_E_OUT_OF_ORDER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287231i32 as _);
pub const SPTLAUDCLNT_E_PROPERTY_NOT_SUPPORTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287228i32 as _);
pub const SPTLAUDCLNT_E_RESOURCES_INVALIDATED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287230i32 as _);
pub const SPTLAUDCLNT_E_STATIC_OBJECT_NOT_AVAILABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287221i32 as _);
pub const SPTLAUDCLNT_E_STREAM_NOT_AVAILABLE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287225i32 as _);
pub const SPTLAUDCLNT_E_STREAM_NOT_STOPPED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004287222i32 as _);
pub const SPTLAUD_MD_CLNT_E_ATTACH_FAILED_INTERNAL_BUFFER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286956i32 as _);
pub const SPTLAUD_MD_CLNT_E_BUFFER_ALREADY_ATTACHED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286969i32 as _);
pub const SPTLAUD_MD_CLNT_E_BUFFER_NOT_ATTACHED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286968i32 as _);
pub const SPTLAUD_MD_CLNT_E_BUFFER_STILL_ATTACHED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286940i32 as _);
pub const SPTLAUD_MD_CLNT_E_COMMAND_ALREADY_WRITTEN: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286942i32 as _);
pub const SPTLAUD_MD_CLNT_E_COMMAND_NOT_FOUND: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286976i32 as _);
pub const SPTLAUD_MD_CLNT_E_DETACH_FAILED_INTERNAL_BUFFER: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286955i32 as _);
pub const SPTLAUD_MD_CLNT_E_FORMAT_MISMATCH: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286941i32 as _);
pub const SPTLAUD_MD_CLNT_E_FRAMECOUNT_OUT_OF_RANGE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286967i32 as _);
pub const SPTLAUD_MD_CLNT_E_FRAMEOFFSET_OUT_OF_RANGE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286952i32 as _);
pub const SPTLAUD_MD_CLNT_E_INVALID_ARGS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286974i32 as _);
pub const SPTLAUD_MD_CLNT_E_ITEMS_ALREADY_OPEN: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286957i32 as _);
pub const SPTLAUD_MD_CLNT_E_ITEMS_LOCKED_FOR_WRITING: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286939i32 as _);
pub const SPTLAUD_MD_CLNT_E_ITEM_COPY_OVERFLOW: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286959i32 as _);
pub const SPTLAUD_MD_CLNT_E_ITEM_MUST_HAVE_COMMANDS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286951i32 as _);
pub const SPTLAUD_MD_CLNT_E_MEMORY_BOUNDS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286971i32 as _);
pub const SPTLAUD_MD_CLNT_E_METADATA_FORMAT_NOT_FOUND: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286973i32 as _);
pub const SPTLAUD_MD_CLNT_E_NO_BUFFER_ATTACHED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286954i32 as _);
pub const SPTLAUD_MD_CLNT_E_NO_ITEMOFFSET_WRITTEN: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286944i32 as _);
pub const SPTLAUD_MD_CLNT_E_NO_ITEMS_FOUND: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286960i32 as _);
pub const SPTLAUD_MD_CLNT_E_NO_ITEMS_OPEN: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286958i32 as _);
pub const SPTLAUD_MD_CLNT_E_NO_ITEMS_WRITTEN: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286943i32 as _);
pub const SPTLAUD_MD_CLNT_E_NO_MORE_COMMANDS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286970i32 as _);
pub const SPTLAUD_MD_CLNT_E_NO_MORE_ITEMS: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286953i32 as _);
pub const SPTLAUD_MD_CLNT_E_OBJECT_NOT_INITIALIZED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286975i32 as _);
pub const SPTLAUD_MD_CLNT_E_VALUE_BUFFER_INCORRECT_SIZE: ::windows::core::HRESULT = ::windows::core::HRESULT(-2004286972i32 as _);
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct SpatialAudioClientActivationParams {
pub tracingContextId: ::windows::core::GUID,
pub appId: ::windows::core::GUID,
pub majorVersion: i32,
pub minorVersion1: i32,
pub minorVersion2: i32,
pub minorVersion3: i32,
}
impl SpatialAudioClientActivationParams {}
impl ::core::default::Default for SpatialAudioClientActivationParams {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::fmt::Debug for SpatialAudioClientActivationParams {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.debug_struct("SpatialAudioClientActivationParams")
.field("tracingContextId", &self.tracingContextId)
.field("appId", &self.appId)
.field("majorVersion", &self.majorVersion)
.field("minorVersion1", &self.minorVersion1)
.field("minorVersion2", &self.minorVersion2)
.field("minorVersion3", &self.minorVersion3)
.finish()
}
}
impl ::core::cmp::PartialEq for SpatialAudioClientActivationParams {
fn eq(&self, other: &Self) -> bool {
self.tracingContextId == other.tracingContextId && self.appId == other.appId && self.majorVersion == other.majorVersion && self.minorVersion1 == other.minorVersion1 && self.minorVersion2 == other.minorVersion2 && self.minorVersion3 == other.minorVersion3
}
}
impl ::core::cmp::Eq for SpatialAudioClientActivationParams {}
unsafe impl ::windows::core::Abi for SpatialAudioClientActivationParams {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::clone::Clone for SpatialAudioHrtfActivationParams {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct SpatialAudioHrtfActivationParams {
pub ObjectFormat: *mut WAVEFORMATEX,
pub StaticObjectTypeMask: AudioObjectType,
pub MinDynamicObjectCount: u32,
pub MaxDynamicObjectCount: u32,
pub Category: AUDIO_STREAM_CATEGORY,
pub EventHandle: super::super::Foundation::HANDLE,
pub NotifyObject: ::core::option::Option<ISpatialAudioObjectRenderStreamNotify>,
pub DistanceDecay: *mut SpatialAudioHrtfDistanceDecay,
pub Directivity: *mut SpatialAudioHrtfDirectivityUnion,
pub Environment: *mut SpatialAudioHrtfEnvironmentType,
pub Orientation: *mut f32,
}
#[cfg(feature = "Win32_Foundation")]
impl SpatialAudioHrtfActivationParams {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for SpatialAudioHrtfActivationParams {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for SpatialAudioHrtfActivationParams {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for SpatialAudioHrtfActivationParams {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for SpatialAudioHrtfActivationParams {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::clone::Clone for SpatialAudioHrtfActivationParams2 {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct SpatialAudioHrtfActivationParams2 {
pub ObjectFormat: *mut WAVEFORMATEX,
pub StaticObjectTypeMask: AudioObjectType,
pub MinDynamicObjectCount: u32,
pub MaxDynamicObjectCount: u32,
pub Category: AUDIO_STREAM_CATEGORY,
pub EventHandle: super::super::Foundation::HANDLE,
pub NotifyObject: ::core::option::Option<ISpatialAudioObjectRenderStreamNotify>,
pub DistanceDecay: *mut SpatialAudioHrtfDistanceDecay,
pub Directivity: *mut SpatialAudioHrtfDirectivityUnion,
pub Environment: *mut SpatialAudioHrtfEnvironmentType,
pub Orientation: *mut f32,
pub Options: SPATIAL_AUDIO_STREAM_OPTIONS,
}
#[cfg(feature = "Win32_Foundation")]
impl SpatialAudioHrtfActivationParams2 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for SpatialAudioHrtfActivationParams2 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for SpatialAudioHrtfActivationParams2 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for SpatialAudioHrtfActivationParams2 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for SpatialAudioHrtfActivationParams2 {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct SpatialAudioHrtfDirectivity {
pub Type: SpatialAudioHrtfDirectivityType,
pub Scaling: f32,
}
impl SpatialAudioHrtfDirectivity {}
impl ::core::default::Default for SpatialAudioHrtfDirectivity {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for SpatialAudioHrtfDirectivity {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for SpatialAudioHrtfDirectivity {}
unsafe impl ::windows::core::Abi for SpatialAudioHrtfDirectivity {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct SpatialAudioHrtfDirectivityCardioid {
pub directivity: SpatialAudioHrtfDirectivity,
pub Order: f32,
}
impl SpatialAudioHrtfDirectivityCardioid {}
impl ::core::default::Default for SpatialAudioHrtfDirectivityCardioid {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for SpatialAudioHrtfDirectivityCardioid {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for SpatialAudioHrtfDirectivityCardioid {}
unsafe impl ::windows::core::Abi for SpatialAudioHrtfDirectivityCardioid {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct SpatialAudioHrtfDirectivityCone {
pub directivity: SpatialAudioHrtfDirectivity,
pub InnerAngle: f32,
pub OuterAngle: f32,
}
impl SpatialAudioHrtfDirectivityCone {}
impl ::core::default::Default for SpatialAudioHrtfDirectivityCone {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for SpatialAudioHrtfDirectivityCone {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for SpatialAudioHrtfDirectivityCone {}
unsafe impl ::windows::core::Abi for SpatialAudioHrtfDirectivityCone {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SpatialAudioHrtfDirectivityType(pub i32);
pub const SpatialAudioHrtfDirectivity_OmniDirectional: SpatialAudioHrtfDirectivityType = SpatialAudioHrtfDirectivityType(0i32);
pub const SpatialAudioHrtfDirectivity_Cardioid: SpatialAudioHrtfDirectivityType = SpatialAudioHrtfDirectivityType(1i32);
pub const SpatialAudioHrtfDirectivity_Cone: SpatialAudioHrtfDirectivityType = SpatialAudioHrtfDirectivityType(2i32);
impl ::core::convert::From<i32> for SpatialAudioHrtfDirectivityType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SpatialAudioHrtfDirectivityType {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub union SpatialAudioHrtfDirectivityUnion {
pub Cone: SpatialAudioHrtfDirectivityCone,
pub Cardiod: SpatialAudioHrtfDirectivityCardioid,
pub Omni: SpatialAudioHrtfDirectivity,
}
impl SpatialAudioHrtfDirectivityUnion {}
impl ::core::default::Default for SpatialAudioHrtfDirectivityUnion {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for SpatialAudioHrtfDirectivityUnion {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for SpatialAudioHrtfDirectivityUnion {}
unsafe impl ::windows::core::Abi for SpatialAudioHrtfDirectivityUnion {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct SpatialAudioHrtfDistanceDecay {
pub Type: SpatialAudioHrtfDistanceDecayType,
pub MaxGain: f32,
pub MinGain: f32,
pub UnityGainDistance: f32,
pub CutoffDistance: f32,
}
impl SpatialAudioHrtfDistanceDecay {}
impl ::core::default::Default for SpatialAudioHrtfDistanceDecay {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for SpatialAudioHrtfDistanceDecay {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for SpatialAudioHrtfDistanceDecay {}
unsafe impl ::windows::core::Abi for SpatialAudioHrtfDistanceDecay {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SpatialAudioHrtfDistanceDecayType(pub i32);
pub const SpatialAudioHrtfDistanceDecay_NaturalDecay: SpatialAudioHrtfDistanceDecayType = SpatialAudioHrtfDistanceDecayType(0i32);
pub const SpatialAudioHrtfDistanceDecay_CustomDecay: SpatialAudioHrtfDistanceDecayType = SpatialAudioHrtfDistanceDecayType(1i32);
impl ::core::convert::From<i32> for SpatialAudioHrtfDistanceDecayType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SpatialAudioHrtfDistanceDecayType {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SpatialAudioHrtfEnvironmentType(pub i32);
pub const SpatialAudioHrtfEnvironment_Small: SpatialAudioHrtfEnvironmentType = SpatialAudioHrtfEnvironmentType(0i32);
pub const SpatialAudioHrtfEnvironment_Medium: SpatialAudioHrtfEnvironmentType = SpatialAudioHrtfEnvironmentType(1i32);
pub const SpatialAudioHrtfEnvironment_Large: SpatialAudioHrtfEnvironmentType = SpatialAudioHrtfEnvironmentType(2i32);
pub const SpatialAudioHrtfEnvironment_Outdoors: SpatialAudioHrtfEnvironmentType = SpatialAudioHrtfEnvironmentType(3i32);
pub const SpatialAudioHrtfEnvironment_Average: SpatialAudioHrtfEnvironmentType = SpatialAudioHrtfEnvironmentType(4i32);
impl ::core::convert::From<i32> for SpatialAudioHrtfEnvironmentType {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SpatialAudioHrtfEnvironmentType {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SpatialAudioMetadataCopyMode(pub i32);
pub const SpatialAudioMetadataCopy_Overwrite: SpatialAudioMetadataCopyMode = SpatialAudioMetadataCopyMode(0i32);
pub const SpatialAudioMetadataCopy_Append: SpatialAudioMetadataCopyMode = SpatialAudioMetadataCopyMode(1i32);
pub const SpatialAudioMetadataCopy_AppendMergeWithLast: SpatialAudioMetadataCopyMode = SpatialAudioMetadataCopyMode(2i32);
pub const SpatialAudioMetadataCopy_AppendMergeWithFirst: SpatialAudioMetadataCopyMode = SpatialAudioMetadataCopyMode(3i32);
impl ::core::convert::From<i32> for SpatialAudioMetadataCopyMode {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SpatialAudioMetadataCopyMode {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct SpatialAudioMetadataItemsInfo {
pub FrameCount: u16,
pub ItemCount: u16,
pub MaxItemCount: u16,
pub MaxValueBufferLength: u32,
}
impl SpatialAudioMetadataItemsInfo {}
impl ::core::default::Default for SpatialAudioMetadataItemsInfo {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for SpatialAudioMetadataItemsInfo {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for SpatialAudioMetadataItemsInfo {}
unsafe impl ::windows::core::Abi for SpatialAudioMetadataItemsInfo {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct SpatialAudioMetadataWriterOverflowMode(pub i32);
pub const SpatialAudioMetadataWriterOverflow_Fail: SpatialAudioMetadataWriterOverflowMode = SpatialAudioMetadataWriterOverflowMode(0i32);
pub const SpatialAudioMetadataWriterOverflow_MergeWithNew: SpatialAudioMetadataWriterOverflowMode = SpatialAudioMetadataWriterOverflowMode(1i32);
pub const SpatialAudioMetadataWriterOverflow_MergeWithLast: SpatialAudioMetadataWriterOverflowMode = SpatialAudioMetadataWriterOverflowMode(2i32);
impl ::core::convert::From<i32> for SpatialAudioMetadataWriterOverflowMode {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for SpatialAudioMetadataWriterOverflowMode {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::clone::Clone for SpatialAudioObjectRenderStreamActivationParams {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct SpatialAudioObjectRenderStreamActivationParams {
pub ObjectFormat: *mut WAVEFORMATEX,
pub StaticObjectTypeMask: AudioObjectType,
pub MinDynamicObjectCount: u32,
pub MaxDynamicObjectCount: u32,
pub Category: AUDIO_STREAM_CATEGORY,
pub EventHandle: super::super::Foundation::HANDLE,
pub NotifyObject: ::core::option::Option<ISpatialAudioObjectRenderStreamNotify>,
}
#[cfg(feature = "Win32_Foundation")]
impl SpatialAudioObjectRenderStreamActivationParams {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for SpatialAudioObjectRenderStreamActivationParams {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for SpatialAudioObjectRenderStreamActivationParams {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for SpatialAudioObjectRenderStreamActivationParams {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for SpatialAudioObjectRenderStreamActivationParams {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::clone::Clone for SpatialAudioObjectRenderStreamActivationParams2 {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct SpatialAudioObjectRenderStreamActivationParams2 {
pub ObjectFormat: *mut WAVEFORMATEX,
pub StaticObjectTypeMask: AudioObjectType,
pub MinDynamicObjectCount: u32,
pub MaxDynamicObjectCount: u32,
pub Category: AUDIO_STREAM_CATEGORY,
pub EventHandle: super::super::Foundation::HANDLE,
pub NotifyObject: ::core::option::Option<ISpatialAudioObjectRenderStreamNotify>,
pub Options: SPATIAL_AUDIO_STREAM_OPTIONS,
}
#[cfg(feature = "Win32_Foundation")]
impl SpatialAudioObjectRenderStreamActivationParams2 {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for SpatialAudioObjectRenderStreamActivationParams2 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for SpatialAudioObjectRenderStreamActivationParams2 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for SpatialAudioObjectRenderStreamActivationParams2 {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for SpatialAudioObjectRenderStreamActivationParams2 {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl ::core::clone::Clone for SpatialAudioObjectRenderStreamForMetadataActivationParams {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
pub struct SpatialAudioObjectRenderStreamForMetadataActivationParams {
pub ObjectFormat: *mut WAVEFORMATEX,
pub StaticObjectTypeMask: AudioObjectType,
pub MinDynamicObjectCount: u32,
pub MaxDynamicObjectCount: u32,
pub Category: AUDIO_STREAM_CATEGORY,
pub EventHandle: super::super::Foundation::HANDLE,
pub MetadataFormatId: ::windows::core::GUID,
pub MaxMetadataItemCount: u16,
pub MetadataActivationParams: *mut super::super::System::Com::StructuredStorage::PROPVARIANT,
pub NotifyObject: ::core::option::Option<ISpatialAudioObjectRenderStreamNotify>,
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl SpatialAudioObjectRenderStreamForMetadataActivationParams {}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl ::core::default::Default for SpatialAudioObjectRenderStreamForMetadataActivationParams {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl ::core::cmp::PartialEq for SpatialAudioObjectRenderStreamForMetadataActivationParams {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl ::core::cmp::Eq for SpatialAudioObjectRenderStreamForMetadataActivationParams {}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
unsafe impl ::windows::core::Abi for SpatialAudioObjectRenderStreamForMetadataActivationParams {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl ::core::clone::Clone for SpatialAudioObjectRenderStreamForMetadataActivationParams2 {
fn clone(&self) -> Self {
unimplemented!()
}
}
#[repr(C, packed(1))]
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
pub struct SpatialAudioObjectRenderStreamForMetadataActivationParams2 {
pub ObjectFormat: *mut WAVEFORMATEX,
pub StaticObjectTypeMask: AudioObjectType,
pub MinDynamicObjectCount: u32,
pub MaxDynamicObjectCount: u32,
pub Category: AUDIO_STREAM_CATEGORY,
pub EventHandle: super::super::Foundation::HANDLE,
pub MetadataFormatId: ::windows::core::GUID,
pub MaxMetadataItemCount: u32,
pub MetadataActivationParams: *mut super::super::System::Com::StructuredStorage::PROPVARIANT,
pub NotifyObject: ::core::option::Option<ISpatialAudioObjectRenderStreamNotify>,
pub Options: SPATIAL_AUDIO_STREAM_OPTIONS,
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl SpatialAudioObjectRenderStreamForMetadataActivationParams2 {}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl ::core::default::Default for SpatialAudioObjectRenderStreamForMetadataActivationParams2 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl ::core::cmp::PartialEq for SpatialAudioObjectRenderStreamForMetadataActivationParams2 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
impl ::core::cmp::Eq for SpatialAudioObjectRenderStreamForMetadataActivationParams2 {}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com", feature = "Win32_System_Com_StructuredStorage"))]
unsafe impl ::windows::core::Abi for SpatialAudioObjectRenderStreamForMetadataActivationParams2 {
type Abi = ::core::mem::ManuallyDrop<Self>;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct VOLUMEWAVEFILTER {
pub wfltr: WAVEFILTER,
pub dwVolume: u32,
}
impl VOLUMEWAVEFILTER {}
impl ::core::default::Default for VOLUMEWAVEFILTER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for VOLUMEWAVEFILTER {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for VOLUMEWAVEFILTER {}
unsafe impl ::windows::core::Abi for VOLUMEWAVEFILTER {
type Abi = Self;
}
pub const WAVECAPS_LRVOLUME: u32 = 8u32;
pub const WAVECAPS_PITCH: u32 = 1u32;
pub const WAVECAPS_PLAYBACKRATE: u32 = 2u32;
pub const WAVECAPS_SAMPLEACCURATE: u32 = 32u32;
pub const WAVECAPS_SYNC: u32 = 16u32;
pub const WAVECAPS_VOLUME: u32 = 4u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct WAVEFILTER {
pub cbStruct: u32,
pub dwFilterTag: u32,
pub fdwFilter: u32,
pub dwReserved: [u32; 5],
}
impl WAVEFILTER {}
impl ::core::default::Default for WAVEFILTER {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEFILTER {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEFILTER {}
unsafe impl ::windows::core::Abi for WAVEFILTER {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct WAVEFORMAT {
pub wFormatTag: u16,
pub nChannels: u16,
pub nSamplesPerSec: u32,
pub nAvgBytesPerSec: u32,
pub nBlockAlign: u16,
}
impl WAVEFORMAT {}
impl ::core::default::Default for WAVEFORMAT {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEFORMAT {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEFORMAT {}
unsafe impl ::windows::core::Abi for WAVEFORMAT {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct WAVEFORMATEX {
pub wFormatTag: u16,
pub nChannels: u16,
pub nSamplesPerSec: u32,
pub nAvgBytesPerSec: u32,
pub nBlockAlign: u16,
pub wBitsPerSample: u16,
pub cbSize: u16,
}
impl WAVEFORMATEX {}
impl ::core::default::Default for WAVEFORMATEX {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEFORMATEX {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEFORMATEX {}
unsafe impl ::windows::core::Abi for WAVEFORMATEX {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct WAVEFORMATEXTENSIBLE {
pub Format: WAVEFORMATEX,
pub Samples: WAVEFORMATEXTENSIBLE_0,
pub dwChannelMask: u32,
pub SubFormat: ::windows::core::GUID,
}
impl WAVEFORMATEXTENSIBLE {}
impl ::core::default::Default for WAVEFORMATEXTENSIBLE {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEFORMATEXTENSIBLE {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEFORMATEXTENSIBLE {}
unsafe impl ::windows::core::Abi for WAVEFORMATEXTENSIBLE {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub union WAVEFORMATEXTENSIBLE_0 {
pub wValidBitsPerSample: u16,
pub wSamplesPerBlock: u16,
pub wReserved: u16,
}
impl WAVEFORMATEXTENSIBLE_0 {}
impl ::core::default::Default for WAVEFORMATEXTENSIBLE_0 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEFORMATEXTENSIBLE_0 {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEFORMATEXTENSIBLE_0 {}
unsafe impl ::windows::core::Abi for WAVEFORMATEXTENSIBLE_0 {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct WAVEHDR {
pub lpData: super::super::Foundation::PSTR,
pub dwBufferLength: u32,
pub dwBytesRecorded: u32,
pub dwUser: usize,
pub dwFlags: u32,
pub dwLoops: u32,
pub lpNext: *mut WAVEHDR,
pub reserved: usize,
}
#[cfg(feature = "Win32_Foundation")]
impl WAVEHDR {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WAVEHDR {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WAVEHDR {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WAVEHDR {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WAVEHDR {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct WAVEINCAPS2A {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
#[cfg(feature = "Win32_Foundation")]
impl WAVEINCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WAVEINCAPS2A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WAVEINCAPS2A {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WAVEINCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WAVEINCAPS2A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct WAVEINCAPS2W {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
impl WAVEINCAPS2W {}
impl ::core::default::Default for WAVEINCAPS2W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEINCAPS2W {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEINCAPS2W {}
unsafe impl ::windows::core::Abi for WAVEINCAPS2W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct WAVEINCAPSA {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
}
#[cfg(feature = "Win32_Foundation")]
impl WAVEINCAPSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WAVEINCAPSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WAVEINCAPSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WAVEINCAPSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WAVEINCAPSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct WAVEINCAPSW {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
}
impl WAVEINCAPSW {}
impl ::core::default::Default for WAVEINCAPSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEINCAPSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEINCAPSW {}
unsafe impl ::windows::core::Abi for WAVEINCAPSW {
type Abi = Self;
}
pub const WAVEIN_MAPPER_STATUS_DEVICE: u32 = 0u32;
pub const WAVEIN_MAPPER_STATUS_FORMAT: u32 = 2u32;
pub const WAVEIN_MAPPER_STATUS_MAPPED: u32 = 1u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct WAVEOUTCAPS2A {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
pub dwSupport: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
#[cfg(feature = "Win32_Foundation")]
impl WAVEOUTCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WAVEOUTCAPS2A {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WAVEOUTCAPS2A {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WAVEOUTCAPS2A {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WAVEOUTCAPS2A {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct WAVEOUTCAPS2W {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
pub dwSupport: u32,
pub ManufacturerGuid: ::windows::core::GUID,
pub ProductGuid: ::windows::core::GUID,
pub NameGuid: ::windows::core::GUID,
}
impl WAVEOUTCAPS2W {}
impl ::core::default::Default for WAVEOUTCAPS2W {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEOUTCAPS2W {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEOUTCAPS2W {}
unsafe impl ::windows::core::Abi for WAVEOUTCAPS2W {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct WAVEOUTCAPSA {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [super::super::Foundation::CHAR; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
pub dwSupport: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl WAVEOUTCAPSA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for WAVEOUTCAPSA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for WAVEOUTCAPSA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for WAVEOUTCAPSA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for WAVEOUTCAPSA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct WAVEOUTCAPSW {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [u16; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
pub dwSupport: u32,
}
impl WAVEOUTCAPSW {}
impl ::core::default::Default for WAVEOUTCAPSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for WAVEOUTCAPSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for WAVEOUTCAPSW {}
unsafe impl ::windows::core::Abi for WAVEOUTCAPSW {
type Abi = Self;
}
pub const WAVEOUT_MAPPER_STATUS_DEVICE: u32 = 0u32;
pub const WAVEOUT_MAPPER_STATUS_FORMAT: u32 = 2u32;
pub const WAVEOUT_MAPPER_STATUS_MAPPED: u32 = 1u32;
pub const WAVERR_BADFORMAT: u32 = 32u32;
pub const WAVERR_LASTERROR: u32 = 35u32;
pub const WAVERR_STILLPLAYING: u32 = 33u32;
pub const WAVERR_SYNC: u32 = 35u32;
pub const WAVERR_UNPREPARED: u32 = 34u32;
pub const WAVE_FORMAT_1M08: u32 = 1u32;
pub const WAVE_FORMAT_1M16: u32 = 4u32;
pub const WAVE_FORMAT_1S08: u32 = 2u32;
pub const WAVE_FORMAT_1S16: u32 = 8u32;
pub const WAVE_FORMAT_2M08: u32 = 16u32;
pub const WAVE_FORMAT_2M16: u32 = 64u32;
pub const WAVE_FORMAT_2S08: u32 = 32u32;
pub const WAVE_FORMAT_2S16: u32 = 128u32;
pub const WAVE_FORMAT_44M08: u32 = 256u32;
pub const WAVE_FORMAT_44M16: u32 = 1024u32;
pub const WAVE_FORMAT_44S08: u32 = 512u32;
pub const WAVE_FORMAT_44S16: u32 = 2048u32;
pub const WAVE_FORMAT_48M08: u32 = 4096u32;
pub const WAVE_FORMAT_48M16: u32 = 16384u32;
pub const WAVE_FORMAT_48S08: u32 = 8192u32;
pub const WAVE_FORMAT_48S16: u32 = 32768u32;
pub const WAVE_FORMAT_4M08: u32 = 256u32;
pub const WAVE_FORMAT_4M16: u32 = 1024u32;
pub const WAVE_FORMAT_4S08: u32 = 512u32;
pub const WAVE_FORMAT_4S16: u32 = 2048u32;
pub const WAVE_FORMAT_96M08: u32 = 65536u32;
pub const WAVE_FORMAT_96M16: u32 = 262144u32;
pub const WAVE_FORMAT_96S08: u32 = 131072u32;
pub const WAVE_FORMAT_96S16: u32 = 524288u32;
pub const WAVE_FORMAT_PCM: u32 = 1u32;
pub const WAVE_INVALIDFORMAT: u32 = 0u32;
pub const WAVE_MAPPER: u32 = 4294967295u32;
pub const WHDR_BEGINLOOP: u32 = 4u32;
pub const WHDR_DONE: u32 = 1u32;
pub const WHDR_ENDLOOP: u32 = 8u32;
pub const WHDR_INQUEUE: u32 = 16u32;
pub const WHDR_PREPARED: u32 = 2u32;
pub const WIDM_MAPPER_STATUS: u32 = 8192u32;
pub const WODM_MAPPER_STATUS: u32 = 8192u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct _AUDCLNT_BUFFERFLAGS(pub i32);
pub const AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY: _AUDCLNT_BUFFERFLAGS = _AUDCLNT_BUFFERFLAGS(1i32);
pub const AUDCLNT_BUFFERFLAGS_SILENT: _AUDCLNT_BUFFERFLAGS = _AUDCLNT_BUFFERFLAGS(2i32);
pub const AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR: _AUDCLNT_BUFFERFLAGS = _AUDCLNT_BUFFERFLAGS(4i32);
impl ::core::convert::From<i32> for _AUDCLNT_BUFFERFLAGS {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for _AUDCLNT_BUFFERFLAGS {
type Abi = Self;
}
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]
pub struct __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002(pub i32);
pub const AUDIO_SYSTEMEFFECTS_PROPERTYSTORE_TYPE_DEFAULT: __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002 = __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002(0i32);
pub const AUDIO_SYSTEMEFFECTS_PROPERTYSTORE_TYPE_USER: __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002 = __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002(1i32);
pub const AUDIO_SYSTEMEFFECTS_PROPERTYSTORE_TYPE_VOLATILE: __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002 = __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002(2i32);
pub const AUDIO_SYSTEMEFFECTS_PROPERTYSTORE_TYPE_ENUM_COUNT: __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002 = __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002(3i32);
impl ::core::convert::From<i32> for __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002 {
fn from(value: i32) -> Self {
Self(value)
}
}
unsafe impl ::windows::core::Abi for __MIDL___MIDL_itf_mmdeviceapi_0000_0008_0002 {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmDriverAddA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HINSTANCE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::LPARAM>>(phadid: *mut isize, hinstmodule: Param1, lparam: Param2, dwpriority: u32, fdwadd: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverAddA(phadid: *mut isize, hinstmodule: super::super::Foundation::HINSTANCE, lparam: super::super::Foundation::LPARAM, dwpriority: u32, fdwadd: u32) -> u32;
}
::core::mem::transmute(acmDriverAddA(::core::mem::transmute(phadid), hinstmodule.into_param().abi(), lparam.into_param().abi(), ::core::mem::transmute(dwpriority), ::core::mem::transmute(fdwadd)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmDriverAddW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HINSTANCE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::LPARAM>>(phadid: *mut isize, hinstmodule: Param1, lparam: Param2, dwpriority: u32, fdwadd: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverAddW(phadid: *mut isize, hinstmodule: super::super::Foundation::HINSTANCE, lparam: super::super::Foundation::LPARAM, dwpriority: u32, fdwadd: u32) -> u32;
}
::core::mem::transmute(acmDriverAddW(::core::mem::transmute(phadid), hinstmodule.into_param().abi(), lparam.into_param().abi(), ::core::mem::transmute(dwpriority), ::core::mem::transmute(fdwadd)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmDriverClose<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, fdwclose: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverClose(had: HACMDRIVER, fdwclose: u32) -> u32;
}
::core::mem::transmute(acmDriverClose(had.into_param().abi(), ::core::mem::transmute(fdwclose)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))]
#[inline]
pub unsafe fn acmDriverDetailsA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVERID>>(hadid: Param0, padd: *mut ACMDRIVERDETAILSA, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverDetailsA(hadid: HACMDRIVERID, padd: *mut ACMDRIVERDETAILSA, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmDriverDetailsA(hadid.into_param().abi(), ::core::mem::transmute(padd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_UI_WindowsAndMessaging")]
#[inline]
pub unsafe fn acmDriverDetailsW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVERID>>(hadid: Param0, padd: *mut ACMDRIVERDETAILSW, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverDetailsW(hadid: HACMDRIVERID, padd: *mut ACMDRIVERDETAILSW, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmDriverDetailsW(hadid.into_param().abi(), ::core::mem::transmute(padd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmDriverEnum(fncallback: ::core::option::Option<ACMDRIVERENUMCB>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverEnum(fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmDriverEnum(::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmDriverID<'a, Param0: ::windows::core::IntoParam<'a, HACMOBJ>>(hao: Param0, phadid: *mut isize, fdwdriverid: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverID(hao: HACMOBJ, phadid: *mut isize, fdwdriverid: u32) -> u32;
}
::core::mem::transmute(acmDriverID(hao.into_param().abi(), ::core::mem::transmute(phadid), ::core::mem::transmute(fdwdriverid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmDriverMessage<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::LPARAM>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::LPARAM>>(had: Param0, umsg: u32, lparam1: Param2, lparam2: Param3) -> super::super::Foundation::LRESULT {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverMessage(had: HACMDRIVER, umsg: u32, lparam1: super::super::Foundation::LPARAM, lparam2: super::super::Foundation::LPARAM) -> super::super::Foundation::LRESULT;
}
::core::mem::transmute(acmDriverMessage(had.into_param().abi(), ::core::mem::transmute(umsg), lparam1.into_param().abi(), lparam2.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmDriverOpen<'a, Param1: ::windows::core::IntoParam<'a, HACMDRIVERID>>(phad: *mut isize, hadid: Param1, fdwopen: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverOpen(phad: *mut isize, hadid: HACMDRIVERID, fdwopen: u32) -> u32;
}
::core::mem::transmute(acmDriverOpen(::core::mem::transmute(phad), hadid.into_param().abi(), ::core::mem::transmute(fdwopen)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmDriverPriority<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVERID>>(hadid: Param0, dwpriority: u32, fdwpriority: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverPriority(hadid: HACMDRIVERID, dwpriority: u32, fdwpriority: u32) -> u32;
}
::core::mem::transmute(acmDriverPriority(hadid.into_param().abi(), ::core::mem::transmute(dwpriority), ::core::mem::transmute(fdwpriority)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmDriverRemove<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVERID>>(hadid: Param0, fdwremove: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmDriverRemove(hadid: HACMDRIVERID, fdwremove: u32) -> u32;
}
::core::mem::transmute(acmDriverRemove(hadid.into_param().abi(), ::core::mem::transmute(fdwremove)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFilterChooseA(pafltrc: *mut ACMFILTERCHOOSEA) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterChooseA(pafltrc: *mut ::core::mem::ManuallyDrop<ACMFILTERCHOOSEA>) -> u32;
}
::core::mem::transmute(acmFilterChooseA(::core::mem::transmute(pafltrc)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFilterChooseW(pafltrc: *mut ACMFILTERCHOOSEW) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterChooseW(pafltrc: *mut ::core::mem::ManuallyDrop<ACMFILTERCHOOSEW>) -> u32;
}
::core::mem::transmute(acmFilterChooseW(::core::mem::transmute(pafltrc)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFilterDetailsA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pafd: *mut ACMFILTERDETAILSA, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterDetailsA(had: HACMDRIVER, pafd: *mut ACMFILTERDETAILSA, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmFilterDetailsA(had.into_param().abi(), ::core::mem::transmute(pafd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmFilterDetailsW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pafd: *mut ACMFILTERDETAILSW, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterDetailsW(had: HACMDRIVER, pafd: *mut ACMFILTERDETAILSW, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmFilterDetailsW(had.into_param().abi(), ::core::mem::transmute(pafd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFilterEnumA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pafd: *mut ACMFILTERDETAILSA, fncallback: ::core::option::Option<ACMFILTERENUMCBA>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterEnumA(had: HACMDRIVER, pafd: *mut ACMFILTERDETAILSA, fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmFilterEnumA(had.into_param().abi(), ::core::mem::transmute(pafd), ::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFilterEnumW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pafd: *mut ACMFILTERDETAILSW, fncallback: ::core::option::Option<ACMFILTERENUMCBW>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterEnumW(had: HACMDRIVER, pafd: *mut ACMFILTERDETAILSW, fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmFilterEnumW(had.into_param().abi(), ::core::mem::transmute(pafd), ::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFilterTagDetailsA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, paftd: *mut ACMFILTERTAGDETAILSA, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterTagDetailsA(had: HACMDRIVER, paftd: *mut ACMFILTERTAGDETAILSA, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmFilterTagDetailsA(had.into_param().abi(), ::core::mem::transmute(paftd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmFilterTagDetailsW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, paftd: *mut ACMFILTERTAGDETAILSW, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterTagDetailsW(had: HACMDRIVER, paftd: *mut ACMFILTERTAGDETAILSW, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmFilterTagDetailsW(had.into_param().abi(), ::core::mem::transmute(paftd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFilterTagEnumA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, paftd: *mut ACMFILTERTAGDETAILSA, fncallback: ::core::option::Option<ACMFILTERTAGENUMCBA>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterTagEnumA(had: HACMDRIVER, paftd: *mut ACMFILTERTAGDETAILSA, fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmFilterTagEnumA(had.into_param().abi(), ::core::mem::transmute(paftd), ::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFilterTagEnumW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, paftd: *mut ACMFILTERTAGDETAILSW, fncallback: ::core::option::Option<ACMFILTERTAGENUMCBW>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFilterTagEnumW(had: HACMDRIVER, paftd: *mut ACMFILTERTAGDETAILSW, fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmFilterTagEnumW(had.into_param().abi(), ::core::mem::transmute(paftd), ::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFormatChooseA(pafmtc: *mut ACMFORMATCHOOSEA) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatChooseA(pafmtc: *mut ::core::mem::ManuallyDrop<ACMFORMATCHOOSEA>) -> u32;
}
::core::mem::transmute(acmFormatChooseA(::core::mem::transmute(pafmtc)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFormatChooseW(pafmtc: *mut ACMFORMATCHOOSEW) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatChooseW(pafmtc: *mut ::core::mem::ManuallyDrop<ACMFORMATCHOOSEW>) -> u32;
}
::core::mem::transmute(acmFormatChooseW(::core::mem::transmute(pafmtc)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFormatDetailsA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pafd: *mut ACMFORMATDETAILSA, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatDetailsA(had: HACMDRIVER, pafd: *mut ACMFORMATDETAILSA, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmFormatDetailsA(had.into_param().abi(), ::core::mem::transmute(pafd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmFormatDetailsW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pafd: *mut tACMFORMATDETAILSW, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatDetailsW(had: HACMDRIVER, pafd: *mut tACMFORMATDETAILSW, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmFormatDetailsW(had.into_param().abi(), ::core::mem::transmute(pafd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFormatEnumA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pafd: *mut ACMFORMATDETAILSA, fncallback: ::core::option::Option<ACMFORMATENUMCBA>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatEnumA(had: HACMDRIVER, pafd: *mut ACMFORMATDETAILSA, fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmFormatEnumA(had.into_param().abi(), ::core::mem::transmute(pafd), ::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFormatEnumW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pafd: *mut tACMFORMATDETAILSW, fncallback: ::core::option::Option<ACMFORMATENUMCBW>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatEnumW(had: HACMDRIVER, pafd: *mut tACMFORMATDETAILSW, fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmFormatEnumW(had.into_param().abi(), ::core::mem::transmute(pafd), ::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmFormatSuggest<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, pwfxsrc: *mut WAVEFORMATEX, pwfxdst: *mut WAVEFORMATEX, cbwfxdst: u32, fdwsuggest: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatSuggest(had: HACMDRIVER, pwfxsrc: *mut WAVEFORMATEX, pwfxdst: *mut WAVEFORMATEX, cbwfxdst: u32, fdwsuggest: u32) -> u32;
}
::core::mem::transmute(acmFormatSuggest(had.into_param().abi(), ::core::mem::transmute(pwfxsrc), ::core::mem::transmute(pwfxdst), ::core::mem::transmute(cbwfxdst), ::core::mem::transmute(fdwsuggest)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFormatTagDetailsA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, paftd: *mut ACMFORMATTAGDETAILSA, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatTagDetailsA(had: HACMDRIVER, paftd: *mut ACMFORMATTAGDETAILSA, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmFormatTagDetailsA(had.into_param().abi(), ::core::mem::transmute(paftd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmFormatTagDetailsW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, paftd: *mut ACMFORMATTAGDETAILSW, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatTagDetailsW(had: HACMDRIVER, paftd: *mut ACMFORMATTAGDETAILSW, fdwdetails: u32) -> u32;
}
::core::mem::transmute(acmFormatTagDetailsW(had.into_param().abi(), ::core::mem::transmute(paftd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFormatTagEnumA<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, paftd: *mut ACMFORMATTAGDETAILSA, fncallback: ::core::option::Option<ACMFORMATTAGENUMCBA>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatTagEnumA(had: HACMDRIVER, paftd: *mut ACMFORMATTAGDETAILSA, fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmFormatTagEnumA(had.into_param().abi(), ::core::mem::transmute(paftd), ::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmFormatTagEnumW<'a, Param0: ::windows::core::IntoParam<'a, HACMDRIVER>>(had: Param0, paftd: *mut ACMFORMATTAGDETAILSW, fncallback: ::core::option::Option<ACMFORMATTAGENUMCBW>, dwinstance: usize, fdwenum: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmFormatTagEnumW(had: HACMDRIVER, paftd: *mut ACMFORMATTAGDETAILSW, fncallback: ::windows::core::RawPtr, dwinstance: usize, fdwenum: u32) -> u32;
}
::core::mem::transmute(acmFormatTagEnumW(had.into_param().abi(), ::core::mem::transmute(paftd), ::core::mem::transmute(fncallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwenum)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmGetVersion() -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmGetVersion() -> u32;
}
::core::mem::transmute(acmGetVersion())
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmMetrics<'a, Param0: ::windows::core::IntoParam<'a, HACMOBJ>>(hao: Param0, umetric: u32, pmetric: *mut ::core::ffi::c_void) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmMetrics(hao: HACMOBJ, umetric: u32, pmetric: *mut ::core::ffi::c_void) -> u32;
}
::core::mem::transmute(acmMetrics(hao.into_param().abi(), ::core::mem::transmute(umetric), ::core::mem::transmute(pmetric)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmStreamClose<'a, Param0: ::windows::core::IntoParam<'a, HACMSTREAM>>(has: Param0, fdwclose: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmStreamClose(has: HACMSTREAM, fdwclose: u32) -> u32;
}
::core::mem::transmute(acmStreamClose(has.into_param().abi(), ::core::mem::transmute(fdwclose)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmStreamConvert<'a, Param0: ::windows::core::IntoParam<'a, HACMSTREAM>>(has: Param0, pash: *mut ACMSTREAMHEADER, fdwconvert: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmStreamConvert(has: HACMSTREAM, pash: *mut ACMSTREAMHEADER, fdwconvert: u32) -> u32;
}
::core::mem::transmute(acmStreamConvert(has.into_param().abi(), ::core::mem::transmute(pash), ::core::mem::transmute(fdwconvert)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn acmStreamMessage<'a, Param0: ::windows::core::IntoParam<'a, HACMSTREAM>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::LPARAM>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::LPARAM>>(has: Param0, umsg: u32, lparam1: Param2, lparam2: Param3) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmStreamMessage(has: HACMSTREAM, umsg: u32, lparam1: super::super::Foundation::LPARAM, lparam2: super::super::Foundation::LPARAM) -> u32;
}
::core::mem::transmute(acmStreamMessage(has.into_param().abi(), ::core::mem::transmute(umsg), lparam1.into_param().abi(), lparam2.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmStreamOpen<'a, Param1: ::windows::core::IntoParam<'a, HACMDRIVER>>(phas: *mut isize, had: Param1, pwfxsrc: *mut WAVEFORMATEX, pwfxdst: *mut WAVEFORMATEX, pwfltr: *mut WAVEFILTER, dwcallback: usize, dwinstance: usize, fdwopen: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmStreamOpen(phas: *mut isize, had: HACMDRIVER, pwfxsrc: *mut WAVEFORMATEX, pwfxdst: *mut WAVEFORMATEX, pwfltr: *mut WAVEFILTER, dwcallback: usize, dwinstance: usize, fdwopen: u32) -> u32;
}
::core::mem::transmute(acmStreamOpen(::core::mem::transmute(phas), had.into_param().abi(), ::core::mem::transmute(pwfxsrc), ::core::mem::transmute(pwfxdst), ::core::mem::transmute(pwfltr), ::core::mem::transmute(dwcallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwopen)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmStreamPrepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HACMSTREAM>>(has: Param0, pash: *mut ACMSTREAMHEADER, fdwprepare: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmStreamPrepareHeader(has: HACMSTREAM, pash: *mut ACMSTREAMHEADER, fdwprepare: u32) -> u32;
}
::core::mem::transmute(acmStreamPrepareHeader(has.into_param().abi(), ::core::mem::transmute(pash), ::core::mem::transmute(fdwprepare)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmStreamReset<'a, Param0: ::windows::core::IntoParam<'a, HACMSTREAM>>(has: Param0, fdwreset: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmStreamReset(has: HACMSTREAM, fdwreset: u32) -> u32;
}
::core::mem::transmute(acmStreamReset(has.into_param().abi(), ::core::mem::transmute(fdwreset)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmStreamSize<'a, Param0: ::windows::core::IntoParam<'a, HACMSTREAM>>(has: Param0, cbinput: u32, pdwoutputbytes: *mut u32, fdwsize: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmStreamSize(has: HACMSTREAM, cbinput: u32, pdwoutputbytes: *mut u32, fdwsize: u32) -> u32;
}
::core::mem::transmute(acmStreamSize(has.into_param().abi(), ::core::mem::transmute(cbinput), ::core::mem::transmute(pdwoutputbytes), ::core::mem::transmute(fdwsize)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn acmStreamUnprepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HACMSTREAM>>(has: Param0, pash: *mut ACMSTREAMHEADER, fdwunprepare: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn acmStreamUnprepareHeader(has: HACMSTREAM, pash: *mut ACMSTREAMHEADER, fdwunprepare: u32) -> u32;
}
::core::mem::transmute(acmStreamUnprepareHeader(has.into_param().abi(), ::core::mem::transmute(pash), ::core::mem::transmute(fdwunprepare)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn auxGetDevCapsA(udeviceid: usize, pac: *mut AUXCAPSA, cbac: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn auxGetDevCapsA(udeviceid: usize, pac: *mut AUXCAPSA, cbac: u32) -> u32;
}
::core::mem::transmute(auxGetDevCapsA(::core::mem::transmute(udeviceid), ::core::mem::transmute(pac), ::core::mem::transmute(cbac)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn auxGetDevCapsW(udeviceid: usize, pac: *mut AUXCAPSW, cbac: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn auxGetDevCapsW(udeviceid: usize, pac: *mut AUXCAPSW, cbac: u32) -> u32;
}
::core::mem::transmute(auxGetDevCapsW(::core::mem::transmute(udeviceid), ::core::mem::transmute(pac), ::core::mem::transmute(cbac)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn auxGetNumDevs() -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn auxGetNumDevs() -> u32;
}
::core::mem::transmute(auxGetNumDevs())
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn auxGetVolume(udeviceid: u32, pdwvolume: *mut u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn auxGetVolume(udeviceid: u32, pdwvolume: *mut u32) -> u32;
}
::core::mem::transmute(auxGetVolume(::core::mem::transmute(udeviceid), ::core::mem::transmute(pdwvolume)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn auxOutMessage(udeviceid: u32, umsg: u32, dw1: usize, dw2: usize) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn auxOutMessage(udeviceid: u32, umsg: u32, dw1: usize, dw2: usize) -> u32;
}
::core::mem::transmute(auxOutMessage(::core::mem::transmute(udeviceid), ::core::mem::transmute(umsg), ::core::mem::transmute(dw1), ::core::mem::transmute(dw2)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn auxSetVolume(udeviceid: u32, dwvolume: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn auxSetVolume(udeviceid: u32, dwvolume: u32) -> u32;
}
::core::mem::transmute(auxSetVolume(::core::mem::transmute(udeviceid), ::core::mem::transmute(dwvolume)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiConnect<'a, Param0: ::windows::core::IntoParam<'a, HMIDI>, Param1: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmi: Param0, hmo: Param1, preserved: *const ::core::ffi::c_void) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiConnect(hmi: HMIDI, hmo: HMIDIOUT, preserved: *const ::core::ffi::c_void) -> u32;
}
::core::mem::transmute(midiConnect(hmi.into_param().abi(), hmo.into_param().abi(), ::core::mem::transmute(preserved)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiDisconnect<'a, Param0: ::windows::core::IntoParam<'a, HMIDI>, Param1: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmi: Param0, hmo: Param1, preserved: *const ::core::ffi::c_void) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiDisconnect(hmi: HMIDI, hmo: HMIDIOUT, preserved: *const ::core::ffi::c_void) -> u32;
}
::core::mem::transmute(midiDisconnect(hmi.into_param().abi(), hmo.into_param().abi(), ::core::mem::transmute(preserved)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiInAddBuffer<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0, pmh: *mut MIDIHDR, cbmh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInAddBuffer(hmi: HMIDIIN, pmh: *mut MIDIHDR, cbmh: u32) -> u32;
}
::core::mem::transmute(midiInAddBuffer(hmi.into_param().abi(), ::core::mem::transmute(pmh), ::core::mem::transmute(cbmh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInClose<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInClose(hmi: HMIDIIN) -> u32;
}
::core::mem::transmute(midiInClose(hmi.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiInGetDevCapsA(udeviceid: usize, pmic: *mut MIDIINCAPSA, cbmic: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInGetDevCapsA(udeviceid: usize, pmic: *mut MIDIINCAPSA, cbmic: u32) -> u32;
}
::core::mem::transmute(midiInGetDevCapsA(::core::mem::transmute(udeviceid), ::core::mem::transmute(pmic), ::core::mem::transmute(cbmic)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInGetDevCapsW(udeviceid: usize, pmic: *mut MIDIINCAPSW, cbmic: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInGetDevCapsW(udeviceid: usize, pmic: *mut MIDIINCAPSW, cbmic: u32) -> u32;
}
::core::mem::transmute(midiInGetDevCapsW(::core::mem::transmute(udeviceid), ::core::mem::transmute(pmic), ::core::mem::transmute(cbmic)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiInGetErrorTextA(mmrerror: u32, psztext: super::super::Foundation::PSTR, cchtext: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInGetErrorTextA(mmrerror: u32, psztext: super::super::Foundation::PSTR, cchtext: u32) -> u32;
}
::core::mem::transmute(midiInGetErrorTextA(::core::mem::transmute(mmrerror), ::core::mem::transmute(psztext), ::core::mem::transmute(cchtext)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiInGetErrorTextW(mmrerror: u32, psztext: super::super::Foundation::PWSTR, cchtext: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInGetErrorTextW(mmrerror: u32, psztext: super::super::Foundation::PWSTR, cchtext: u32) -> u32;
}
::core::mem::transmute(midiInGetErrorTextW(::core::mem::transmute(mmrerror), ::core::mem::transmute(psztext), ::core::mem::transmute(cchtext)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInGetID<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0, pudeviceid: *mut u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInGetID(hmi: HMIDIIN, pudeviceid: *mut u32) -> u32;
}
::core::mem::transmute(midiInGetID(hmi.into_param().abi(), ::core::mem::transmute(pudeviceid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInGetNumDevs() -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInGetNumDevs() -> u32;
}
::core::mem::transmute(midiInGetNumDevs())
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInMessage<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0, umsg: u32, dw1: usize, dw2: usize) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInMessage(hmi: HMIDIIN, umsg: u32, dw1: usize, dw2: usize) -> u32;
}
::core::mem::transmute(midiInMessage(hmi.into_param().abi(), ::core::mem::transmute(umsg), ::core::mem::transmute(dw1), ::core::mem::transmute(dw2)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInOpen(phmi: *mut HMIDIIN, udeviceid: u32, dwcallback: usize, dwinstance: usize, fdwopen: MIDI_WAVE_OPEN_TYPE) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInOpen(phmi: *mut HMIDIIN, udeviceid: u32, dwcallback: usize, dwinstance: usize, fdwopen: MIDI_WAVE_OPEN_TYPE) -> u32;
}
::core::mem::transmute(midiInOpen(::core::mem::transmute(phmi), ::core::mem::transmute(udeviceid), ::core::mem::transmute(dwcallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwopen)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiInPrepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0, pmh: *mut MIDIHDR, cbmh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInPrepareHeader(hmi: HMIDIIN, pmh: *mut MIDIHDR, cbmh: u32) -> u32;
}
::core::mem::transmute(midiInPrepareHeader(hmi.into_param().abi(), ::core::mem::transmute(pmh), ::core::mem::transmute(cbmh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInReset<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInReset(hmi: HMIDIIN) -> u32;
}
::core::mem::transmute(midiInReset(hmi.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInStart<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInStart(hmi: HMIDIIN) -> u32;
}
::core::mem::transmute(midiInStart(hmi.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiInStop<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInStop(hmi: HMIDIIN) -> u32;
}
::core::mem::transmute(midiInStop(hmi.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiInUnprepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HMIDIIN>>(hmi: Param0, pmh: *mut MIDIHDR, cbmh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiInUnprepareHeader(hmi: HMIDIIN, pmh: *mut MIDIHDR, cbmh: u32) -> u32;
}
::core::mem::transmute(midiInUnprepareHeader(hmi.into_param().abi(), ::core::mem::transmute(pmh), ::core::mem::transmute(cbmh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutCacheDrumPatches<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, upatch: u32, pwkya: *const u16, fucache: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutCacheDrumPatches(hmo: HMIDIOUT, upatch: u32, pwkya: *const u16, fucache: u32) -> u32;
}
::core::mem::transmute(midiOutCacheDrumPatches(hmo.into_param().abi(), ::core::mem::transmute(upatch), ::core::mem::transmute(pwkya), ::core::mem::transmute(fucache)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutCachePatches<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, ubank: u32, pwpa: *const u16, fucache: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutCachePatches(hmo: HMIDIOUT, ubank: u32, pwpa: *const u16, fucache: u32) -> u32;
}
::core::mem::transmute(midiOutCachePatches(hmo.into_param().abi(), ::core::mem::transmute(ubank), ::core::mem::transmute(pwpa), ::core::mem::transmute(fucache)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutClose<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutClose(hmo: HMIDIOUT) -> u32;
}
::core::mem::transmute(midiOutClose(hmo.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiOutGetDevCapsA(udeviceid: usize, pmoc: *mut MIDIOUTCAPSA, cbmoc: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutGetDevCapsA(udeviceid: usize, pmoc: *mut MIDIOUTCAPSA, cbmoc: u32) -> u32;
}
::core::mem::transmute(midiOutGetDevCapsA(::core::mem::transmute(udeviceid), ::core::mem::transmute(pmoc), ::core::mem::transmute(cbmoc)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutGetDevCapsW(udeviceid: usize, pmoc: *mut MIDIOUTCAPSW, cbmoc: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutGetDevCapsW(udeviceid: usize, pmoc: *mut MIDIOUTCAPSW, cbmoc: u32) -> u32;
}
::core::mem::transmute(midiOutGetDevCapsW(::core::mem::transmute(udeviceid), ::core::mem::transmute(pmoc), ::core::mem::transmute(cbmoc)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiOutGetErrorTextA(mmrerror: u32, psztext: super::super::Foundation::PSTR, cchtext: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutGetErrorTextA(mmrerror: u32, psztext: super::super::Foundation::PSTR, cchtext: u32) -> u32;
}
::core::mem::transmute(midiOutGetErrorTextA(::core::mem::transmute(mmrerror), ::core::mem::transmute(psztext), ::core::mem::transmute(cchtext)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiOutGetErrorTextW(mmrerror: u32, psztext: super::super::Foundation::PWSTR, cchtext: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutGetErrorTextW(mmrerror: u32, psztext: super::super::Foundation::PWSTR, cchtext: u32) -> u32;
}
::core::mem::transmute(midiOutGetErrorTextW(::core::mem::transmute(mmrerror), ::core::mem::transmute(psztext), ::core::mem::transmute(cchtext)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutGetID<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, pudeviceid: *mut u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutGetID(hmo: HMIDIOUT, pudeviceid: *mut u32) -> u32;
}
::core::mem::transmute(midiOutGetID(hmo.into_param().abi(), ::core::mem::transmute(pudeviceid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutGetNumDevs() -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutGetNumDevs() -> u32;
}
::core::mem::transmute(midiOutGetNumDevs())
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutGetVolume<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, pdwvolume: *mut u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutGetVolume(hmo: HMIDIOUT, pdwvolume: *mut u32) -> u32;
}
::core::mem::transmute(midiOutGetVolume(hmo.into_param().abi(), ::core::mem::transmute(pdwvolume)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiOutLongMsg<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, pmh: *const MIDIHDR, cbmh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutLongMsg(hmo: HMIDIOUT, pmh: *const MIDIHDR, cbmh: u32) -> u32;
}
::core::mem::transmute(midiOutLongMsg(hmo.into_param().abi(), ::core::mem::transmute(pmh), ::core::mem::transmute(cbmh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutMessage<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, umsg: u32, dw1: usize, dw2: usize) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutMessage(hmo: HMIDIOUT, umsg: u32, dw1: usize, dw2: usize) -> u32;
}
::core::mem::transmute(midiOutMessage(hmo.into_param().abi(), ::core::mem::transmute(umsg), ::core::mem::transmute(dw1), ::core::mem::transmute(dw2)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutOpen(phmo: *mut HMIDIOUT, udeviceid: u32, dwcallback: usize, dwinstance: usize, fdwopen: MIDI_WAVE_OPEN_TYPE) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutOpen(phmo: *mut HMIDIOUT, udeviceid: u32, dwcallback: usize, dwinstance: usize, fdwopen: MIDI_WAVE_OPEN_TYPE) -> u32;
}
::core::mem::transmute(midiOutOpen(::core::mem::transmute(phmo), ::core::mem::transmute(udeviceid), ::core::mem::transmute(dwcallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwopen)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiOutPrepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, pmh: *mut MIDIHDR, cbmh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutPrepareHeader(hmo: HMIDIOUT, pmh: *mut MIDIHDR, cbmh: u32) -> u32;
}
::core::mem::transmute(midiOutPrepareHeader(hmo.into_param().abi(), ::core::mem::transmute(pmh), ::core::mem::transmute(cbmh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutReset<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutReset(hmo: HMIDIOUT) -> u32;
}
::core::mem::transmute(midiOutReset(hmo.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutSetVolume<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, dwvolume: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutSetVolume(hmo: HMIDIOUT, dwvolume: u32) -> u32;
}
::core::mem::transmute(midiOutSetVolume(hmo.into_param().abi(), ::core::mem::transmute(dwvolume)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiOutShortMsg<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, dwmsg: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutShortMsg(hmo: HMIDIOUT, dwmsg: u32) -> u32;
}
::core::mem::transmute(midiOutShortMsg(hmo.into_param().abi(), ::core::mem::transmute(dwmsg)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiOutUnprepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HMIDIOUT>>(hmo: Param0, pmh: *mut MIDIHDR, cbmh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiOutUnprepareHeader(hmo: HMIDIOUT, pmh: *mut MIDIHDR, cbmh: u32) -> u32;
}
::core::mem::transmute(midiOutUnprepareHeader(hmo.into_param().abi(), ::core::mem::transmute(pmh), ::core::mem::transmute(cbmh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiStreamClose<'a, Param0: ::windows::core::IntoParam<'a, HMIDISTRM>>(hms: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiStreamClose(hms: HMIDISTRM) -> u32;
}
::core::mem::transmute(midiStreamClose(hms.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiStreamOpen(phms: *mut HMIDISTRM, pudeviceid: *mut u32, cmidi: u32, dwcallback: usize, dwinstance: usize, fdwopen: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiStreamOpen(phms: *mut HMIDISTRM, pudeviceid: *mut u32, cmidi: u32, dwcallback: usize, dwinstance: usize, fdwopen: u32) -> u32;
}
::core::mem::transmute(midiStreamOpen(::core::mem::transmute(phms), ::core::mem::transmute(pudeviceid), ::core::mem::transmute(cmidi), ::core::mem::transmute(dwcallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwopen)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn midiStreamOut<'a, Param0: ::windows::core::IntoParam<'a, HMIDISTRM>>(hms: Param0, pmh: *mut MIDIHDR, cbmh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiStreamOut(hms: HMIDISTRM, pmh: *mut MIDIHDR, cbmh: u32) -> u32;
}
::core::mem::transmute(midiStreamOut(hms.into_param().abi(), ::core::mem::transmute(pmh), ::core::mem::transmute(cbmh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiStreamPause<'a, Param0: ::windows::core::IntoParam<'a, HMIDISTRM>>(hms: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiStreamPause(hms: HMIDISTRM) -> u32;
}
::core::mem::transmute(midiStreamPause(hms.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiStreamPosition<'a, Param0: ::windows::core::IntoParam<'a, HMIDISTRM>>(hms: Param0, lpmmt: *mut super::MMTIME, cbmmt: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiStreamPosition(hms: HMIDISTRM, lpmmt: *mut super::MMTIME, cbmmt: u32) -> u32;
}
::core::mem::transmute(midiStreamPosition(hms.into_param().abi(), ::core::mem::transmute(lpmmt), ::core::mem::transmute(cbmmt)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiStreamProperty<'a, Param0: ::windows::core::IntoParam<'a, HMIDISTRM>>(hms: Param0, lppropdata: *mut u8, dwproperty: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiStreamProperty(hms: HMIDISTRM, lppropdata: *mut u8, dwproperty: u32) -> u32;
}
::core::mem::transmute(midiStreamProperty(hms.into_param().abi(), ::core::mem::transmute(lppropdata), ::core::mem::transmute(dwproperty)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiStreamRestart<'a, Param0: ::windows::core::IntoParam<'a, HMIDISTRM>>(hms: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiStreamRestart(hms: HMIDISTRM) -> u32;
}
::core::mem::transmute(midiStreamRestart(hms.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn midiStreamStop<'a, Param0: ::windows::core::IntoParam<'a, HMIDISTRM>>(hms: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn midiStreamStop(hms: HMIDISTRM) -> u32;
}
::core::mem::transmute(midiStreamStop(hms.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn mixerClose<'a, Param0: ::windows::core::IntoParam<'a, HMIXER>>(hmx: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerClose(hmx: HMIXER) -> u32;
}
::core::mem::transmute(mixerClose(hmx.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn mixerGetControlDetailsA<'a, Param0: ::windows::core::IntoParam<'a, HMIXEROBJ>>(hmxobj: Param0, pmxcd: *mut MIXERCONTROLDETAILS, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetControlDetailsA(hmxobj: HMIXEROBJ, pmxcd: *mut MIXERCONTROLDETAILS, fdwdetails: u32) -> u32;
}
::core::mem::transmute(mixerGetControlDetailsA(hmxobj.into_param().abi(), ::core::mem::transmute(pmxcd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn mixerGetControlDetailsW<'a, Param0: ::windows::core::IntoParam<'a, HMIXEROBJ>>(hmxobj: Param0, pmxcd: *mut MIXERCONTROLDETAILS, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetControlDetailsW(hmxobj: HMIXEROBJ, pmxcd: *mut MIXERCONTROLDETAILS, fdwdetails: u32) -> u32;
}
::core::mem::transmute(mixerGetControlDetailsW(hmxobj.into_param().abi(), ::core::mem::transmute(pmxcd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn mixerGetDevCapsA(umxid: usize, pmxcaps: *mut MIXERCAPSA, cbmxcaps: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetDevCapsA(umxid: usize, pmxcaps: *mut MIXERCAPSA, cbmxcaps: u32) -> u32;
}
::core::mem::transmute(mixerGetDevCapsA(::core::mem::transmute(umxid), ::core::mem::transmute(pmxcaps), ::core::mem::transmute(cbmxcaps)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn mixerGetDevCapsW(umxid: usize, pmxcaps: *mut MIXERCAPSW, cbmxcaps: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetDevCapsW(umxid: usize, pmxcaps: *mut MIXERCAPSW, cbmxcaps: u32) -> u32;
}
::core::mem::transmute(mixerGetDevCapsW(::core::mem::transmute(umxid), ::core::mem::transmute(pmxcaps), ::core::mem::transmute(cbmxcaps)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn mixerGetID<'a, Param0: ::windows::core::IntoParam<'a, HMIXEROBJ>>(hmxobj: Param0, pumxid: *mut u32, fdwid: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetID(hmxobj: HMIXEROBJ, pumxid: *mut u32, fdwid: u32) -> u32;
}
::core::mem::transmute(mixerGetID(hmxobj.into_param().abi(), ::core::mem::transmute(pumxid), ::core::mem::transmute(fdwid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn mixerGetLineControlsA<'a, Param0: ::windows::core::IntoParam<'a, HMIXEROBJ>>(hmxobj: Param0, pmxlc: *mut MIXERLINECONTROLSA, fdwcontrols: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetLineControlsA(hmxobj: HMIXEROBJ, pmxlc: *mut MIXERLINECONTROLSA, fdwcontrols: u32) -> u32;
}
::core::mem::transmute(mixerGetLineControlsA(hmxobj.into_param().abi(), ::core::mem::transmute(pmxlc), ::core::mem::transmute(fdwcontrols)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn mixerGetLineControlsW<'a, Param0: ::windows::core::IntoParam<'a, HMIXEROBJ>>(hmxobj: Param0, pmxlc: *mut MIXERLINECONTROLSW, fdwcontrols: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetLineControlsW(hmxobj: HMIXEROBJ, pmxlc: *mut MIXERLINECONTROLSW, fdwcontrols: u32) -> u32;
}
::core::mem::transmute(mixerGetLineControlsW(hmxobj.into_param().abi(), ::core::mem::transmute(pmxlc), ::core::mem::transmute(fdwcontrols)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn mixerGetLineInfoA<'a, Param0: ::windows::core::IntoParam<'a, HMIXEROBJ>>(hmxobj: Param0, pmxl: *mut MIXERLINEA, fdwinfo: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetLineInfoA(hmxobj: HMIXEROBJ, pmxl: *mut MIXERLINEA, fdwinfo: u32) -> u32;
}
::core::mem::transmute(mixerGetLineInfoA(hmxobj.into_param().abi(), ::core::mem::transmute(pmxl), ::core::mem::transmute(fdwinfo)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn mixerGetLineInfoW<'a, Param0: ::windows::core::IntoParam<'a, HMIXEROBJ>>(hmxobj: Param0, pmxl: *mut MIXERLINEW, fdwinfo: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetLineInfoW(hmxobj: HMIXEROBJ, pmxl: *mut MIXERLINEW, fdwinfo: u32) -> u32;
}
::core::mem::transmute(mixerGetLineInfoW(hmxobj.into_param().abi(), ::core::mem::transmute(pmxl), ::core::mem::transmute(fdwinfo)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn mixerGetNumDevs() -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerGetNumDevs() -> u32;
}
::core::mem::transmute(mixerGetNumDevs())
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn mixerMessage<'a, Param0: ::windows::core::IntoParam<'a, HMIXER>>(hmx: Param0, umsg: u32, dwparam1: usize, dwparam2: usize) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerMessage(hmx: HMIXER, umsg: u32, dwparam1: usize, dwparam2: usize) -> u32;
}
::core::mem::transmute(mixerMessage(hmx.into_param().abi(), ::core::mem::transmute(umsg), ::core::mem::transmute(dwparam1), ::core::mem::transmute(dwparam2)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn mixerOpen(phmx: *mut isize, umxid: u32, dwcallback: usize, dwinstance: usize, fdwopen: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerOpen(phmx: *mut isize, umxid: u32, dwcallback: usize, dwinstance: usize, fdwopen: u32) -> u32;
}
::core::mem::transmute(mixerOpen(::core::mem::transmute(phmx), ::core::mem::transmute(umxid), ::core::mem::transmute(dwcallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwopen)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn mixerSetControlDetails<'a, Param0: ::windows::core::IntoParam<'a, HMIXEROBJ>>(hmxobj: Param0, pmxcd: *const MIXERCONTROLDETAILS, fdwdetails: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn mixerSetControlDetails(hmxobj: HMIXEROBJ, pmxcd: *const MIXERCONTROLDETAILS, fdwdetails: u32) -> u32;
}
::core::mem::transmute(mixerSetControlDetails(hmxobj.into_param().abi(), ::core::mem::transmute(pmxcd), ::core::mem::transmute(fdwdetails)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn sndPlaySoundA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszsound: Param0, fusound: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn sndPlaySoundA(pszsound: super::super::Foundation::PSTR, fusound: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(sndPlaySoundA(pszsound.into_param().abi(), ::core::mem::transmute(fusound)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn sndPlaySoundW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszsound: Param0, fusound: u32) -> super::super::Foundation::BOOL {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn sndPlaySoundW(pszsound: super::super::Foundation::PWSTR, fusound: u32) -> super::super::Foundation::BOOL;
}
::core::mem::transmute(sndPlaySoundW(pszsound.into_param().abi(), ::core::mem::transmute(fusound)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct tACMDRVOPENDESCA {
pub cbStruct: u32,
pub fccType: u32,
pub fccComp: u32,
pub dwVersion: u32,
pub dwFlags: u32,
pub dwError: u32,
pub pszSectionName: super::super::Foundation::PSTR,
pub pszAliasName: super::super::Foundation::PSTR,
pub dnDevNode: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl tACMDRVOPENDESCA {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for tACMDRVOPENDESCA {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for tACMDRVOPENDESCA {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for tACMDRVOPENDESCA {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for tACMDRVOPENDESCA {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
#[cfg(feature = "Win32_Foundation")]
pub struct tACMDRVOPENDESCW {
pub cbStruct: u32,
pub fccType: u32,
pub fccComp: u32,
pub dwVersion: u32,
pub dwFlags: u32,
pub dwError: u32,
pub pszSectionName: super::super::Foundation::PWSTR,
pub pszAliasName: super::super::Foundation::PWSTR,
pub dnDevNode: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl tACMDRVOPENDESCW {}
#[cfg(feature = "Win32_Foundation")]
impl ::core::default::Default for tACMDRVOPENDESCW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::PartialEq for tACMDRVOPENDESCW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::cmp::Eq for tACMDRVOPENDESCW {}
#[cfg(feature = "Win32_Foundation")]
unsafe impl ::windows::core::Abi for tACMDRVOPENDESCW {
type Abi = Self;
}
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C, packed(1))]
pub struct tACMFORMATDETAILSW {
pub cbStruct: u32,
pub dwFormatIndex: u32,
pub dwFormatTag: u32,
pub fdwSupport: u32,
pub pwfx: *mut WAVEFORMATEX,
pub cbwfx: u32,
pub szFormat: [u16; 128],
}
impl tACMFORMATDETAILSW {}
impl ::core::default::Default for tACMFORMATDETAILSW {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl ::core::cmp::PartialEq for tACMFORMATDETAILSW {
fn eq(&self, _other: &Self) -> bool {
unimplemented!()
}
}
impl ::core::cmp::Eq for tACMFORMATDETAILSW {}
unsafe impl ::windows::core::Abi for tACMFORMATDETAILSW {
type Abi = Self;
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveInAddBuffer<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0, pwh: *mut WAVEHDR, cbwh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInAddBuffer(hwi: HWAVEIN, pwh: *mut WAVEHDR, cbwh: u32) -> u32;
}
::core::mem::transmute(waveInAddBuffer(hwi.into_param().abi(), ::core::mem::transmute(pwh), ::core::mem::transmute(cbwh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInClose<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInClose(hwi: HWAVEIN) -> u32;
}
::core::mem::transmute(waveInClose(hwi.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveInGetDevCapsA(udeviceid: usize, pwic: *mut WAVEINCAPSA, cbwic: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInGetDevCapsA(udeviceid: usize, pwic: *mut WAVEINCAPSA, cbwic: u32) -> u32;
}
::core::mem::transmute(waveInGetDevCapsA(::core::mem::transmute(udeviceid), ::core::mem::transmute(pwic), ::core::mem::transmute(cbwic)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInGetDevCapsW(udeviceid: usize, pwic: *mut WAVEINCAPSW, cbwic: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInGetDevCapsW(udeviceid: usize, pwic: *mut WAVEINCAPSW, cbwic: u32) -> u32;
}
::core::mem::transmute(waveInGetDevCapsW(::core::mem::transmute(udeviceid), ::core::mem::transmute(pwic), ::core::mem::transmute(cbwic)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveInGetErrorTextA(mmrerror: u32, psztext: super::super::Foundation::PSTR, cchtext: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInGetErrorTextA(mmrerror: u32, psztext: super::super::Foundation::PSTR, cchtext: u32) -> u32;
}
::core::mem::transmute(waveInGetErrorTextA(::core::mem::transmute(mmrerror), ::core::mem::transmute(psztext), ::core::mem::transmute(cchtext)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveInGetErrorTextW(mmrerror: u32, psztext: super::super::Foundation::PWSTR, cchtext: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInGetErrorTextW(mmrerror: u32, psztext: super::super::Foundation::PWSTR, cchtext: u32) -> u32;
}
::core::mem::transmute(waveInGetErrorTextW(::core::mem::transmute(mmrerror), ::core::mem::transmute(psztext), ::core::mem::transmute(cchtext)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInGetID<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0, pudeviceid: *const u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInGetID(hwi: HWAVEIN, pudeviceid: *const u32) -> u32;
}
::core::mem::transmute(waveInGetID(hwi.into_param().abi(), ::core::mem::transmute(pudeviceid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInGetNumDevs() -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInGetNumDevs() -> u32;
}
::core::mem::transmute(waveInGetNumDevs())
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInGetPosition<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0, pmmt: *mut super::MMTIME, cbmmt: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInGetPosition(hwi: HWAVEIN, pmmt: *mut super::MMTIME, cbmmt: u32) -> u32;
}
::core::mem::transmute(waveInGetPosition(hwi.into_param().abi(), ::core::mem::transmute(pmmt), ::core::mem::transmute(cbmmt)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInMessage<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0, umsg: u32, dw1: usize, dw2: usize) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInMessage(hwi: HWAVEIN, umsg: u32, dw1: usize, dw2: usize) -> u32;
}
::core::mem::transmute(waveInMessage(hwi.into_param().abi(), ::core::mem::transmute(umsg), ::core::mem::transmute(dw1), ::core::mem::transmute(dw2)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInOpen(phwi: *mut HWAVEIN, udeviceid: u32, pwfx: *const WAVEFORMATEX, dwcallback: usize, dwinstance: usize, fdwopen: MIDI_WAVE_OPEN_TYPE) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInOpen(phwi: *mut HWAVEIN, udeviceid: u32, pwfx: *const WAVEFORMATEX, dwcallback: usize, dwinstance: usize, fdwopen: MIDI_WAVE_OPEN_TYPE) -> u32;
}
::core::mem::transmute(waveInOpen(::core::mem::transmute(phwi), ::core::mem::transmute(udeviceid), ::core::mem::transmute(pwfx), ::core::mem::transmute(dwcallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwopen)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveInPrepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0, pwh: *mut WAVEHDR, cbwh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInPrepareHeader(hwi: HWAVEIN, pwh: *mut WAVEHDR, cbwh: u32) -> u32;
}
::core::mem::transmute(waveInPrepareHeader(hwi.into_param().abi(), ::core::mem::transmute(pwh), ::core::mem::transmute(cbwh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInReset<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInReset(hwi: HWAVEIN) -> u32;
}
::core::mem::transmute(waveInReset(hwi.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInStart<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInStart(hwi: HWAVEIN) -> u32;
}
::core::mem::transmute(waveInStart(hwi.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveInStop<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInStop(hwi: HWAVEIN) -> u32;
}
::core::mem::transmute(waveInStop(hwi.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveInUnprepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HWAVEIN>>(hwi: Param0, pwh: *mut WAVEHDR, cbwh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveInUnprepareHeader(hwi: HWAVEIN, pwh: *mut WAVEHDR, cbwh: u32) -> u32;
}
::core::mem::transmute(waveInUnprepareHeader(hwi.into_param().abi(), ::core::mem::transmute(pwh), ::core::mem::transmute(cbwh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutBreakLoop<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutBreakLoop(hwo: HWAVEOUT) -> u32;
}
::core::mem::transmute(waveOutBreakLoop(hwo.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutClose<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutClose(hwo: HWAVEOUT) -> u32;
}
::core::mem::transmute(waveOutClose(hwo.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveOutGetDevCapsA(udeviceid: usize, pwoc: *mut WAVEOUTCAPSA, cbwoc: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetDevCapsA(udeviceid: usize, pwoc: *mut WAVEOUTCAPSA, cbwoc: u32) -> u32;
}
::core::mem::transmute(waveOutGetDevCapsA(::core::mem::transmute(udeviceid), ::core::mem::transmute(pwoc), ::core::mem::transmute(cbwoc)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutGetDevCapsW(udeviceid: usize, pwoc: *mut WAVEOUTCAPSW, cbwoc: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetDevCapsW(udeviceid: usize, pwoc: *mut WAVEOUTCAPSW, cbwoc: u32) -> u32;
}
::core::mem::transmute(waveOutGetDevCapsW(::core::mem::transmute(udeviceid), ::core::mem::transmute(pwoc), ::core::mem::transmute(cbwoc)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveOutGetErrorTextA(mmrerror: u32, psztext: super::super::Foundation::PSTR, cchtext: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetErrorTextA(mmrerror: u32, psztext: super::super::Foundation::PSTR, cchtext: u32) -> u32;
}
::core::mem::transmute(waveOutGetErrorTextA(::core::mem::transmute(mmrerror), ::core::mem::transmute(psztext), ::core::mem::transmute(cchtext)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveOutGetErrorTextW(mmrerror: u32, psztext: super::super::Foundation::PWSTR, cchtext: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetErrorTextW(mmrerror: u32, psztext: super::super::Foundation::PWSTR, cchtext: u32) -> u32;
}
::core::mem::transmute(waveOutGetErrorTextW(::core::mem::transmute(mmrerror), ::core::mem::transmute(psztext), ::core::mem::transmute(cchtext)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutGetID<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, pudeviceid: *mut u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetID(hwo: HWAVEOUT, pudeviceid: *mut u32) -> u32;
}
::core::mem::transmute(waveOutGetID(hwo.into_param().abi(), ::core::mem::transmute(pudeviceid)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutGetNumDevs() -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetNumDevs() -> u32;
}
::core::mem::transmute(waveOutGetNumDevs())
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutGetPitch<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, pdwpitch: *mut u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetPitch(hwo: HWAVEOUT, pdwpitch: *mut u32) -> u32;
}
::core::mem::transmute(waveOutGetPitch(hwo.into_param().abi(), ::core::mem::transmute(pdwpitch)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutGetPlaybackRate<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, pdwrate: *mut u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetPlaybackRate(hwo: HWAVEOUT, pdwrate: *mut u32) -> u32;
}
::core::mem::transmute(waveOutGetPlaybackRate(hwo.into_param().abi(), ::core::mem::transmute(pdwrate)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutGetPosition<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, pmmt: *mut super::MMTIME, cbmmt: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetPosition(hwo: HWAVEOUT, pmmt: *mut super::MMTIME, cbmmt: u32) -> u32;
}
::core::mem::transmute(waveOutGetPosition(hwo.into_param().abi(), ::core::mem::transmute(pmmt), ::core::mem::transmute(cbmmt)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutGetVolume<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, pdwvolume: *mut u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutGetVolume(hwo: HWAVEOUT, pdwvolume: *mut u32) -> u32;
}
::core::mem::transmute(waveOutGetVolume(hwo.into_param().abi(), ::core::mem::transmute(pdwvolume)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutMessage<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, umsg: u32, dw1: usize, dw2: usize) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutMessage(hwo: HWAVEOUT, umsg: u32, dw1: usize, dw2: usize) -> u32;
}
::core::mem::transmute(waveOutMessage(hwo.into_param().abi(), ::core::mem::transmute(umsg), ::core::mem::transmute(dw1), ::core::mem::transmute(dw2)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutOpen(phwo: *mut HWAVEOUT, udeviceid: u32, pwfx: *const WAVEFORMATEX, dwcallback: usize, dwinstance: usize, fdwopen: MIDI_WAVE_OPEN_TYPE) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutOpen(phwo: *mut HWAVEOUT, udeviceid: u32, pwfx: *const WAVEFORMATEX, dwcallback: usize, dwinstance: usize, fdwopen: MIDI_WAVE_OPEN_TYPE) -> u32;
}
::core::mem::transmute(waveOutOpen(::core::mem::transmute(phwo), ::core::mem::transmute(udeviceid), ::core::mem::transmute(pwfx), ::core::mem::transmute(dwcallback), ::core::mem::transmute(dwinstance), ::core::mem::transmute(fdwopen)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutPause<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutPause(hwo: HWAVEOUT) -> u32;
}
::core::mem::transmute(waveOutPause(hwo.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveOutPrepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, pwh: *mut WAVEHDR, cbwh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutPrepareHeader(hwo: HWAVEOUT, pwh: *mut WAVEHDR, cbwh: u32) -> u32;
}
::core::mem::transmute(waveOutPrepareHeader(hwo.into_param().abi(), ::core::mem::transmute(pwh), ::core::mem::transmute(cbwh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutReset<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutReset(hwo: HWAVEOUT) -> u32;
}
::core::mem::transmute(waveOutReset(hwo.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutRestart<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutRestart(hwo: HWAVEOUT) -> u32;
}
::core::mem::transmute(waveOutRestart(hwo.into_param().abi()))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutSetPitch<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, dwpitch: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutSetPitch(hwo: HWAVEOUT, dwpitch: u32) -> u32;
}
::core::mem::transmute(waveOutSetPitch(hwo.into_param().abi(), ::core::mem::transmute(dwpitch)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutSetPlaybackRate<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, dwrate: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutSetPlaybackRate(hwo: HWAVEOUT, dwrate: u32) -> u32;
}
::core::mem::transmute(waveOutSetPlaybackRate(hwo.into_param().abi(), ::core::mem::transmute(dwrate)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[inline]
pub unsafe fn waveOutSetVolume<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, dwvolume: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutSetVolume(hwo: HWAVEOUT, dwvolume: u32) -> u32;
}
::core::mem::transmute(waveOutSetVolume(hwo.into_param().abi(), ::core::mem::transmute(dwvolume)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveOutUnprepareHeader<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, pwh: *mut WAVEHDR, cbwh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutUnprepareHeader(hwo: HWAVEOUT, pwh: *mut WAVEHDR, cbwh: u32) -> u32;
}
::core::mem::transmute(waveOutUnprepareHeader(hwo.into_param().abi(), ::core::mem::transmute(pwh), ::core::mem::transmute(cbwh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn waveOutWrite<'a, Param0: ::windows::core::IntoParam<'a, HWAVEOUT>>(hwo: Param0, pwh: *mut WAVEHDR, cbwh: u32) -> u32 {
#[cfg(windows)]
{
#[link(name = "windows")]
extern "system" {
fn waveOutWrite(hwo: HWAVEOUT, pwh: *mut WAVEHDR, cbwh: u32) -> u32;
}
::core::mem::transmute(waveOutWrite(hwo.into_param().abi(), ::core::mem::transmute(pwh), ::core::mem::transmute(cbwh)))
}
#[cfg(not(windows))]
unimplemented!("Unsupported target OS");
}
|
#![feature(proc_macro_hygiene, decl_macro)]
extern crate rocket;
extern crate rocket_contrib;
extern crate dotenv;
use rocket_contrib::templates::Template;
use frontend;
fn main() {
dotenv::dotenv();
std::process::Command::new("rm")
.arg("./cache/*")
.status()
.unwrap(); // clears the cache
frontend::add_routes(rocket::ignite())
.attach(Template::fairing())
.launch();
}
|
use crate::*;
impl<'t> Package<'t> {
pub fn insintric_gcd(&self) -> ItemId {
self.bodies.iter().find(|(_, body)| body.attributes.lang && body.name == "__insintric_gcd").map(|e| *e.0).unwrap()
}
pub fn insintric_lcm(&self) -> ItemId {
self.bodies.iter().find(|(_, body)| body.attributes.lang && body.name == "__insintric_lcm").map(|e| *e.0).unwrap()
}
}
impl<'t> Body<'t> {
pub fn is_polymorphic(&self) -> bool {
!self.generics.is_empty()
}
pub fn args(&self) -> Vec<&Local<'t>> {
self.locals.iter().map(|l| l.1).filter(|l| l.kind == LocalKind::Arg).collect()
}
pub fn rets(&self) -> Vec<&Local<'t>> {
self.locals.iter().map(|l| l.1).filter(|l| l.kind == LocalKind::Ret).collect()
}
pub fn max_local_id(&self) -> LocalId {
let mut max = LocalId(0);
for (id, _) in &self.locals {
max = std::cmp::max(max, *id);
}
max
}
pub fn max_block_id(&self) -> BlockId {
let mut max = BlockId(0);
for (id, _) in &self.blocks {
max = std::cmp::max(max, *id);
}
max
}
}
impl Place {
pub fn merge(&self, other: &Place) -> Place {
let mut elems = self.elems.clone();
elems.extend(other.elems.clone());
Place {
base: other.base.clone(),
elems,
}
}
}
impl BlockId {
pub const FIRST: BlockId = BlockId(0);
}
impl Addr {
pub fn id(&self) -> ItemId {
match self {
Addr::Id(id) => *id,
Addr::Name(_) => unreachable!(),
}
}
pub fn id_mut(&mut self) -> &mut ItemId {
match self {
Addr::Id(id) => id,
Addr::Name(_) => unreachable!(),
}
}
pub fn name(&self) -> &str {
match self {
Addr::Name(name) => name,
Addr::Id(_) => unreachable!(),
}
}
}
impl std::ops::Add for LocalId {
type Output = LocalId;
fn add(self, rhs: LocalId) -> LocalId {
LocalId(self.0 + rhs.0)
}
}
impl std::ops::Add for BlockId {
type Output = BlockId;
fn add(self, rhs: BlockId) -> BlockId {
BlockId(self.0 + rhs.0)
}
}
pub struct Mut<'a, T>{
ptr: *mut T,
_marker: std::marker::PhantomData<&'a mut T>,
}
#[allow(non_snake_case)]
pub fn Mut<'a, T>(ptr: &'a mut T) -> Mut<'a, T> {
Mut { ptr, _marker: std::marker::PhantomData }
}
impl<'a, T> Mut<'a, T> {
pub fn get(&self) -> &'a T {
unsafe { & *self.ptr }
}
pub fn get_mut(&self) -> &'a mut T {
unsafe { &mut *self.ptr }
}
}
impl<'a, T> std::ops::Deref for Mut<'a, T> {
type Target = T;
fn deref(&self) -> &T {
self.get()
}
}
impl<'a, T> std::ops::DerefMut for Mut<'a, T> {
fn deref_mut(&mut self) -> &mut T {
self.get_mut()
}
}
|
use crate::headers::{Error, Header, HeaderName, HeaderValue};
use hyper::http::{header, Uri};
use std::iter;
static LOCATION: &HeaderName = &header::LOCATION;
#[derive(Clone, Debug, PartialEq)]
pub struct Location(Uri);
impl Location {
pub fn uri(&self) -> &Uri {
&self.0
}
}
impl Header for Location {
fn name() -> &'static HeaderName {
LOCATION
}
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
where
Self: Sized,
I: Iterator<Item = &'i HeaderValue>,
{
values
.next()
.and_then(|v| v.to_str().ok()?.parse().ok())
.map(Location)
.ok_or_else(Error::invalid)
}
fn encode<E: Extend<HeaderValue>>(&self, values: &mut E) {
values.extend(iter::once(self.into()))
}
}
impl From<Uri> for Location {
fn from(uri: Uri) -> Self {
Location(uri)
}
}
impl From<&Location> for HeaderValue {
fn from(location: &Location) -> Self {
location.0.to_string().parse().unwrap()
}
}
#[cfg(test)]
mod test {
use super::Location;
use crate::headers::HeaderMapExt;
use crate::test::headers::encode;
use hyper::http::{header, HeaderMap, Uri};
#[test]
fn test_encode_relative_location() {
let uri: Uri = "/foo/bar?baz".parse().unwrap();
assert_eq!(encode(Location(uri)).to_str().unwrap(), "/foo/bar?baz")
}
#[test]
fn test_encode_absolute_location() {
let uri: Uri = "https://example.com/foo/bar?baz".parse().unwrap();
assert_eq!(
encode(Location(uri)).to_str().unwrap(),
"https://example.com/foo/bar?baz"
)
}
#[test]
fn test_decode_relative_location() {
let uri = "/foo/bar?baz";
let mut headers = HeaderMap::new();
headers.insert(header::LOCATION, uri.parse().unwrap());
let location = headers.typed_get::<Location>().unwrap();
assert_eq!(location.uri(), &(uri.parse::<Uri>().unwrap()))
}
#[test]
fn test_decode_absolute_location() {
let uri = "https://example.com/foo/bar?baz";
let mut headers = HeaderMap::new();
headers.insert(header::LOCATION, uri.parse().unwrap());
let location = headers.typed_get::<Location>().unwrap();
assert_eq!(location.uri(), &(uri.parse::<Uri>().unwrap()))
}
}
|
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qabstractitemview.h
// dst-file: /src/widgets/qabstractitemview.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
// <= main block end
// use block begin =>
use super::qabstractscrollarea::*; // 773
use std::ops::Deref;
use super::super::core::qabstractitemmodel::*; // 771
use super::qwidget::*; // 773
use super::super::core::qsize::*; // 771
use super::qabstractitemdelegate::*; // 773
use super::super::core::qstring::*; // 771
use super::super::core::qitemselectionmodel::*; // 771
use super::super::core::qrect::*; // 771
use super::super::core::qpoint::*; // 771
use super::super::core::qobjectdefs::*; // 771
// <= use block end
// ext block begin =>
// #[link(name = "Qt5Core")]
// #[link(name = "Qt5Gui")]
// #[link(name = "Qt5Widgets")]
// #[link(name = "QtInline")]
extern {
fn QAbstractItemView_Class_Size() -> c_int;
// proto: QWidget * QAbstractItemView::indexWidget(const QModelIndex & index);
fn C_ZNK17QAbstractItemView11indexWidgetERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void;
// proto: void QAbstractItemView::scrollToBottom();
fn C_ZN17QAbstractItemView14scrollToBottomEv(qthis: u64 /* *mut c_void*/);
// proto: void QAbstractItemView::setDropIndicatorShown(bool enable);
fn C_ZN17QAbstractItemView21setDropIndicatorShownEb(qthis: u64 /* *mut c_void*/, arg0: c_char);
// proto: QSize QAbstractItemView::sizeHintForIndex(const QModelIndex & index);
fn C_ZNK17QAbstractItemView16sizeHintForIndexERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void;
// proto: void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate * delegate);
fn C_ZN17QAbstractItemView24setItemDelegateForColumnEiP21QAbstractItemDelegate(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void);
// proto: bool QAbstractItemView::dragEnabled();
fn C_ZNK17QAbstractItemView11dragEnabledEv(qthis: u64 /* *mut c_void*/) -> c_char;
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegate(const QModelIndex & index);
fn C_ZNK17QAbstractItemView12itemDelegateERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void;
// proto: void QAbstractItemView::keyboardSearch(const QString & search);
fn C_ZN17QAbstractItemView14keyboardSearchERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: QModelIndex QAbstractItemView::rootIndex();
fn C_ZNK17QAbstractItemView9rootIndexEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegateForColumn(int column);
fn C_ZNK17QAbstractItemView21itemDelegateForColumnEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void;
// proto: QItemSelectionModel * QAbstractItemView::selectionModel();
fn C_ZNK17QAbstractItemView14selectionModelEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QAbstractItemView::reset();
fn C_ZN17QAbstractItemView5resetEv(qthis: u64 /* *mut c_void*/);
// proto: void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate * delegate);
fn C_ZN17QAbstractItemView21setItemDelegateForRowEiP21QAbstractItemDelegate(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void);
// proto: void QAbstractItemView::setRootIndex(const QModelIndex & index);
fn C_ZN17QAbstractItemView12setRootIndexERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QAbstractItemView::setAutoScrollMargin(int margin);
fn C_ZN17QAbstractItemView19setAutoScrollMarginEi(qthis: u64 /* *mut c_void*/, arg0: c_int);
// proto: QRect QAbstractItemView::visualRect(const QModelIndex & index);
fn C_ZNK17QAbstractItemView10visualRectERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void;
// proto: void QAbstractItemView::doItemsLayout();
fn C_ZN17QAbstractItemView13doItemsLayoutEv(qthis: u64 /* *mut c_void*/);
// proto: void QAbstractItemView::~QAbstractItemView();
fn C_ZN17QAbstractItemViewD2Ev(qthis: u64 /* *mut c_void*/);
// proto: QAbstractItemModel * QAbstractItemView::model();
fn C_ZNK17QAbstractItemView5modelEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: QSize QAbstractItemView::iconSize();
fn C_ZNK17QAbstractItemView8iconSizeEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QAbstractItemView::setItemDelegate(QAbstractItemDelegate * delegate);
fn C_ZN17QAbstractItemView15setItemDelegateEP21QAbstractItemDelegate(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QAbstractItemView::setDragEnabled(bool enable);
fn C_ZN17QAbstractItemView14setDragEnabledEb(qthis: u64 /* *mut c_void*/, arg0: c_char);
// proto: QModelIndex QAbstractItemView::currentIndex();
fn C_ZNK17QAbstractItemView12currentIndexEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: int QAbstractItemView::sizeHintForRow(int row);
fn C_ZNK17QAbstractItemView14sizeHintForRowEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int;
// proto: void QAbstractItemView::QAbstractItemView(QWidget * parent);
fn C_ZN17QAbstractItemViewC2EP7QWidget(arg0: *mut c_void) -> u64;
// proto: bool QAbstractItemView::showDropIndicator();
fn C_ZNK17QAbstractItemView17showDropIndicatorEv(qthis: u64 /* *mut c_void*/) -> c_char;
// proto: bool QAbstractItemView::hasAutoScroll();
fn C_ZNK17QAbstractItemView13hasAutoScrollEv(qthis: u64 /* *mut c_void*/) -> c_char;
// proto: void QAbstractItemView::selectAll();
fn C_ZN17QAbstractItemView9selectAllEv(qthis: u64 /* *mut c_void*/);
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegate();
fn C_ZNK17QAbstractItemView12itemDelegateEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QAbstractItemView::edit(const QModelIndex & index);
fn C_ZN17QAbstractItemView4editERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QAbstractItemView::setAlternatingRowColors(bool enable);
fn C_ZN17QAbstractItemView23setAlternatingRowColorsEb(qthis: u64 /* *mut c_void*/, arg0: c_char);
// proto: int QAbstractItemView::sizeHintForColumn(int column);
fn C_ZNK17QAbstractItemView17sizeHintForColumnEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int;
// proto: void QAbstractItemView::setIconSize(const QSize & size);
fn C_ZN17QAbstractItemView11setIconSizeERK5QSize(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QAbstractItemView::closePersistentEditor(const QModelIndex & index);
fn C_ZN17QAbstractItemView21closePersistentEditorERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QAbstractItemView::setDragDropOverwriteMode(bool overwrite);
fn C_ZN17QAbstractItemView24setDragDropOverwriteModeEb(qthis: u64 /* *mut c_void*/, arg0: c_char);
// proto: void QAbstractItemView::clearSelection();
fn C_ZN17QAbstractItemView14clearSelectionEv(qthis: u64 /* *mut c_void*/);
// proto: void QAbstractItemView::scrollToTop();
fn C_ZN17QAbstractItemView11scrollToTopEv(qthis: u64 /* *mut c_void*/);
// proto: void QAbstractItemView::setSelectionModel(QItemSelectionModel * selectionModel);
fn C_ZN17QAbstractItemView17setSelectionModelEP19QItemSelectionModel(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QAbstractItemView::setCurrentIndex(const QModelIndex & index);
fn C_ZN17QAbstractItemView15setCurrentIndexERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: QModelIndex QAbstractItemView::indexAt(const QPoint & point);
fn C_ZNK17QAbstractItemView7indexAtERK6QPoint(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void;
// proto: void QAbstractItemView::setTabKeyNavigation(bool enable);
fn C_ZN17QAbstractItemView19setTabKeyNavigationEb(qthis: u64 /* *mut c_void*/, arg0: c_char);
// proto: void QAbstractItemView::setIndexWidget(const QModelIndex & index, QWidget * widget);
fn C_ZN17QAbstractItemView14setIndexWidgetERK11QModelIndexP7QWidget(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void);
// proto: void QAbstractItemView::setAutoScroll(bool enable);
fn C_ZN17QAbstractItemView13setAutoScrollEb(qthis: u64 /* *mut c_void*/, arg0: c_char);
// proto: void QAbstractItemView::setModel(QAbstractItemModel * model);
fn C_ZN17QAbstractItemView8setModelEP18QAbstractItemModel(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QAbstractItemView::update(const QModelIndex & index);
fn C_ZN17QAbstractItemView6updateERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: const QMetaObject * QAbstractItemView::metaObject();
fn C_ZNK17QAbstractItemView10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QAbstractItemView::openPersistentEditor(const QModelIndex & index);
fn C_ZN17QAbstractItemView20openPersistentEditorERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegateForRow(int row);
fn C_ZNK17QAbstractItemView18itemDelegateForRowEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void;
// proto: bool QAbstractItemView::dragDropOverwriteMode();
fn C_ZNK17QAbstractItemView21dragDropOverwriteModeEv(qthis: u64 /* *mut c_void*/) -> c_char;
// proto: bool QAbstractItemView::tabKeyNavigation();
fn C_ZNK17QAbstractItemView16tabKeyNavigationEv(qthis: u64 /* *mut c_void*/) -> c_char;
// proto: int QAbstractItemView::autoScrollMargin();
fn C_ZNK17QAbstractItemView16autoScrollMarginEv(qthis: u64 /* *mut c_void*/) -> c_int;
// proto: bool QAbstractItemView::alternatingRowColors();
fn C_ZNK17QAbstractItemView20alternatingRowColorsEv(qthis: u64 /* *mut c_void*/) -> c_char;
fn QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7enteredERK11QModelIndex(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView13doubleClickedERK11QModelIndex(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7pressedERK11QModelIndex(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView15viewportEnteredEv(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView15iconSizeChangedERK5QSize(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView9activatedERK11QModelIndex(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7clickedERK11QModelIndex(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
} // <= ext block end
// body block begin =>
// class sizeof(QAbstractItemView)=1
#[derive(Default)]
pub struct QAbstractItemView {
qbase: QAbstractScrollArea,
pub qclsinst: u64 /* *mut c_void*/,
pub _iconSizeChanged: QAbstractItemView_iconSizeChanged_signal,
pub _clicked: QAbstractItemView_clicked_signal,
pub _viewportEntered: QAbstractItemView_viewportEntered_signal,
pub _activated: QAbstractItemView_activated_signal,
pub _pressed: QAbstractItemView_pressed_signal,
pub _entered: QAbstractItemView_entered_signal,
pub _doubleClicked: QAbstractItemView_doubleClicked_signal,
}
impl /*struct*/ QAbstractItemView {
pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QAbstractItemView {
return QAbstractItemView{qbase: QAbstractScrollArea::inheritFrom(qthis), qclsinst: qthis, ..Default::default()};
}
}
impl Deref for QAbstractItemView {
type Target = QAbstractScrollArea;
fn deref(&self) -> &QAbstractScrollArea {
return & self.qbase;
}
}
impl AsRef<QAbstractScrollArea> for QAbstractItemView {
fn as_ref(& self) -> & QAbstractScrollArea {
return & self.qbase;
}
}
// proto: QWidget * QAbstractItemView::indexWidget(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn indexWidget<RetType, T: QAbstractItemView_indexWidget<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.indexWidget(self);
// return 1;
}
}
pub trait QAbstractItemView_indexWidget<RetType> {
fn indexWidget(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QWidget * QAbstractItemView::indexWidget(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_indexWidget<QWidget> for (&'a QModelIndex) {
fn indexWidget(self , rsthis: & QAbstractItemView) -> QWidget {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView11indexWidgetERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK17QAbstractItemView11indexWidgetERK11QModelIndex(rsthis.qclsinst, arg0)};
let mut ret1 = QWidget::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::scrollToBottom();
impl /*struct*/ QAbstractItemView {
pub fn scrollToBottom<RetType, T: QAbstractItemView_scrollToBottom<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.scrollToBottom(self);
// return 1;
}
}
pub trait QAbstractItemView_scrollToBottom<RetType> {
fn scrollToBottom(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::scrollToBottom();
impl<'a> /*trait*/ QAbstractItemView_scrollToBottom<()> for () {
fn scrollToBottom(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView14scrollToBottomEv()};
unsafe {C_ZN17QAbstractItemView14scrollToBottomEv(rsthis.qclsinst)};
// return 1;
}
}
// proto: void QAbstractItemView::setDropIndicatorShown(bool enable);
impl /*struct*/ QAbstractItemView {
pub fn setDropIndicatorShown<RetType, T: QAbstractItemView_setDropIndicatorShown<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setDropIndicatorShown(self);
// return 1;
}
}
pub trait QAbstractItemView_setDropIndicatorShown<RetType> {
fn setDropIndicatorShown(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setDropIndicatorShown(bool enable);
impl<'a> /*trait*/ QAbstractItemView_setDropIndicatorShown<()> for (i8) {
fn setDropIndicatorShown(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView21setDropIndicatorShownEb()};
let arg0 = self as c_char;
unsafe {C_ZN17QAbstractItemView21setDropIndicatorShownEb(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QSize QAbstractItemView::sizeHintForIndex(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn sizeHintForIndex<RetType, T: QAbstractItemView_sizeHintForIndex<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.sizeHintForIndex(self);
// return 1;
}
}
pub trait QAbstractItemView_sizeHintForIndex<RetType> {
fn sizeHintForIndex(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QSize QAbstractItemView::sizeHintForIndex(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_sizeHintForIndex<QSize> for (&'a QModelIndex) {
fn sizeHintForIndex(self , rsthis: & QAbstractItemView) -> QSize {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView16sizeHintForIndexERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK17QAbstractItemView16sizeHintForIndexERK11QModelIndex(rsthis.qclsinst, arg0)};
let mut ret1 = QSize::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate * delegate);
impl /*struct*/ QAbstractItemView {
pub fn setItemDelegateForColumn<RetType, T: QAbstractItemView_setItemDelegateForColumn<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setItemDelegateForColumn(self);
// return 1;
}
}
pub trait QAbstractItemView_setItemDelegateForColumn<RetType> {
fn setItemDelegateForColumn(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate * delegate);
impl<'a> /*trait*/ QAbstractItemView_setItemDelegateForColumn<()> for (i32, &'a QAbstractItemDelegate) {
fn setItemDelegateForColumn(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView24setItemDelegateForColumnEiP21QAbstractItemDelegate()};
let arg0 = self.0 as c_int;
let arg1 = self.1.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView24setItemDelegateForColumnEiP21QAbstractItemDelegate(rsthis.qclsinst, arg0, arg1)};
// return 1;
}
}
// proto: bool QAbstractItemView::dragEnabled();
impl /*struct*/ QAbstractItemView {
pub fn dragEnabled<RetType, T: QAbstractItemView_dragEnabled<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.dragEnabled(self);
// return 1;
}
}
pub trait QAbstractItemView_dragEnabled<RetType> {
fn dragEnabled(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: bool QAbstractItemView::dragEnabled();
impl<'a> /*trait*/ QAbstractItemView_dragEnabled<i8> for () {
fn dragEnabled(self , rsthis: & QAbstractItemView) -> i8 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView11dragEnabledEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView11dragEnabledEv(rsthis.qclsinst)};
return ret as i8; // 1
// return 1;
}
}
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegate(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn itemDelegate<RetType, T: QAbstractItemView_itemDelegate<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.itemDelegate(self);
// return 1;
}
}
pub trait QAbstractItemView_itemDelegate<RetType> {
fn itemDelegate(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegate(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_itemDelegate<QAbstractItemDelegate> for (&'a QModelIndex) {
fn itemDelegate(self , rsthis: & QAbstractItemView) -> QAbstractItemDelegate {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView12itemDelegateERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK17QAbstractItemView12itemDelegateERK11QModelIndex(rsthis.qclsinst, arg0)};
let mut ret1 = QAbstractItemDelegate::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::keyboardSearch(const QString & search);
impl /*struct*/ QAbstractItemView {
pub fn keyboardSearch<RetType, T: QAbstractItemView_keyboardSearch<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.keyboardSearch(self);
// return 1;
}
}
pub trait QAbstractItemView_keyboardSearch<RetType> {
fn keyboardSearch(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::keyboardSearch(const QString & search);
impl<'a> /*trait*/ QAbstractItemView_keyboardSearch<()> for (&'a QString) {
fn keyboardSearch(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView14keyboardSearchERK7QString()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView14keyboardSearchERK7QString(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QModelIndex QAbstractItemView::rootIndex();
impl /*struct*/ QAbstractItemView {
pub fn rootIndex<RetType, T: QAbstractItemView_rootIndex<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.rootIndex(self);
// return 1;
}
}
pub trait QAbstractItemView_rootIndex<RetType> {
fn rootIndex(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QModelIndex QAbstractItemView::rootIndex();
impl<'a> /*trait*/ QAbstractItemView_rootIndex<QModelIndex> for () {
fn rootIndex(self , rsthis: & QAbstractItemView) -> QModelIndex {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView9rootIndexEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView9rootIndexEv(rsthis.qclsinst)};
let mut ret1 = QModelIndex::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegateForColumn(int column);
impl /*struct*/ QAbstractItemView {
pub fn itemDelegateForColumn<RetType, T: QAbstractItemView_itemDelegateForColumn<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.itemDelegateForColumn(self);
// return 1;
}
}
pub trait QAbstractItemView_itemDelegateForColumn<RetType> {
fn itemDelegateForColumn(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegateForColumn(int column);
impl<'a> /*trait*/ QAbstractItemView_itemDelegateForColumn<QAbstractItemDelegate> for (i32) {
fn itemDelegateForColumn(self , rsthis: & QAbstractItemView) -> QAbstractItemDelegate {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView21itemDelegateForColumnEi()};
let arg0 = self as c_int;
let mut ret = unsafe {C_ZNK17QAbstractItemView21itemDelegateForColumnEi(rsthis.qclsinst, arg0)};
let mut ret1 = QAbstractItemDelegate::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QItemSelectionModel * QAbstractItemView::selectionModel();
impl /*struct*/ QAbstractItemView {
pub fn selectionModel<RetType, T: QAbstractItemView_selectionModel<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.selectionModel(self);
// return 1;
}
}
pub trait QAbstractItemView_selectionModel<RetType> {
fn selectionModel(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QItemSelectionModel * QAbstractItemView::selectionModel();
impl<'a> /*trait*/ QAbstractItemView_selectionModel<QItemSelectionModel> for () {
fn selectionModel(self , rsthis: & QAbstractItemView) -> QItemSelectionModel {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView14selectionModelEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView14selectionModelEv(rsthis.qclsinst)};
let mut ret1 = QItemSelectionModel::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::reset();
impl /*struct*/ QAbstractItemView {
pub fn reset<RetType, T: QAbstractItemView_reset<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.reset(self);
// return 1;
}
}
pub trait QAbstractItemView_reset<RetType> {
fn reset(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::reset();
impl<'a> /*trait*/ QAbstractItemView_reset<()> for () {
fn reset(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView5resetEv()};
unsafe {C_ZN17QAbstractItemView5resetEv(rsthis.qclsinst)};
// return 1;
}
}
// proto: void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate * delegate);
impl /*struct*/ QAbstractItemView {
pub fn setItemDelegateForRow<RetType, T: QAbstractItemView_setItemDelegateForRow<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setItemDelegateForRow(self);
// return 1;
}
}
pub trait QAbstractItemView_setItemDelegateForRow<RetType> {
fn setItemDelegateForRow(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate * delegate);
impl<'a> /*trait*/ QAbstractItemView_setItemDelegateForRow<()> for (i32, &'a QAbstractItemDelegate) {
fn setItemDelegateForRow(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView21setItemDelegateForRowEiP21QAbstractItemDelegate()};
let arg0 = self.0 as c_int;
let arg1 = self.1.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView21setItemDelegateForRowEiP21QAbstractItemDelegate(rsthis.qclsinst, arg0, arg1)};
// return 1;
}
}
// proto: void QAbstractItemView::setRootIndex(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn setRootIndex<RetType, T: QAbstractItemView_setRootIndex<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setRootIndex(self);
// return 1;
}
}
pub trait QAbstractItemView_setRootIndex<RetType> {
fn setRootIndex(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setRootIndex(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_setRootIndex<()> for (&'a QModelIndex) {
fn setRootIndex(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView12setRootIndexERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView12setRootIndexERK11QModelIndex(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::setAutoScrollMargin(int margin);
impl /*struct*/ QAbstractItemView {
pub fn setAutoScrollMargin<RetType, T: QAbstractItemView_setAutoScrollMargin<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setAutoScrollMargin(self);
// return 1;
}
}
pub trait QAbstractItemView_setAutoScrollMargin<RetType> {
fn setAutoScrollMargin(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setAutoScrollMargin(int margin);
impl<'a> /*trait*/ QAbstractItemView_setAutoScrollMargin<()> for (i32) {
fn setAutoScrollMargin(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView19setAutoScrollMarginEi()};
let arg0 = self as c_int;
unsafe {C_ZN17QAbstractItemView19setAutoScrollMarginEi(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QRect QAbstractItemView::visualRect(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn visualRect<RetType, T: QAbstractItemView_visualRect<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.visualRect(self);
// return 1;
}
}
pub trait QAbstractItemView_visualRect<RetType> {
fn visualRect(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QRect QAbstractItemView::visualRect(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_visualRect<QRect> for (&'a QModelIndex) {
fn visualRect(self , rsthis: & QAbstractItemView) -> QRect {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView10visualRectERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK17QAbstractItemView10visualRectERK11QModelIndex(rsthis.qclsinst, arg0)};
let mut ret1 = QRect::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::doItemsLayout();
impl /*struct*/ QAbstractItemView {
pub fn doItemsLayout<RetType, T: QAbstractItemView_doItemsLayout<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.doItemsLayout(self);
// return 1;
}
}
pub trait QAbstractItemView_doItemsLayout<RetType> {
fn doItemsLayout(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::doItemsLayout();
impl<'a> /*trait*/ QAbstractItemView_doItemsLayout<()> for () {
fn doItemsLayout(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView13doItemsLayoutEv()};
unsafe {C_ZN17QAbstractItemView13doItemsLayoutEv(rsthis.qclsinst)};
// return 1;
}
}
// proto: void QAbstractItemView::~QAbstractItemView();
impl /*struct*/ QAbstractItemView {
pub fn free<RetType, T: QAbstractItemView_free<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.free(self);
// return 1;
}
}
pub trait QAbstractItemView_free<RetType> {
fn free(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::~QAbstractItemView();
impl<'a> /*trait*/ QAbstractItemView_free<()> for () {
fn free(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemViewD2Ev()};
unsafe {C_ZN17QAbstractItemViewD2Ev(rsthis.qclsinst)};
// return 1;
}
}
// proto: QAbstractItemModel * QAbstractItemView::model();
impl /*struct*/ QAbstractItemView {
pub fn model<RetType, T: QAbstractItemView_model<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.model(self);
// return 1;
}
}
pub trait QAbstractItemView_model<RetType> {
fn model(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QAbstractItemModel * QAbstractItemView::model();
impl<'a> /*trait*/ QAbstractItemView_model<QAbstractItemModel> for () {
fn model(self , rsthis: & QAbstractItemView) -> QAbstractItemModel {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView5modelEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView5modelEv(rsthis.qclsinst)};
let mut ret1 = QAbstractItemModel::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QSize QAbstractItemView::iconSize();
impl /*struct*/ QAbstractItemView {
pub fn iconSize<RetType, T: QAbstractItemView_iconSize<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.iconSize(self);
// return 1;
}
}
pub trait QAbstractItemView_iconSize<RetType> {
fn iconSize(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QSize QAbstractItemView::iconSize();
impl<'a> /*trait*/ QAbstractItemView_iconSize<QSize> for () {
fn iconSize(self , rsthis: & QAbstractItemView) -> QSize {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView8iconSizeEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView8iconSizeEv(rsthis.qclsinst)};
let mut ret1 = QSize::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::setItemDelegate(QAbstractItemDelegate * delegate);
impl /*struct*/ QAbstractItemView {
pub fn setItemDelegate<RetType, T: QAbstractItemView_setItemDelegate<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setItemDelegate(self);
// return 1;
}
}
pub trait QAbstractItemView_setItemDelegate<RetType> {
fn setItemDelegate(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setItemDelegate(QAbstractItemDelegate * delegate);
impl<'a> /*trait*/ QAbstractItemView_setItemDelegate<()> for (&'a QAbstractItemDelegate) {
fn setItemDelegate(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView15setItemDelegateEP21QAbstractItemDelegate()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView15setItemDelegateEP21QAbstractItemDelegate(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::setDragEnabled(bool enable);
impl /*struct*/ QAbstractItemView {
pub fn setDragEnabled<RetType, T: QAbstractItemView_setDragEnabled<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setDragEnabled(self);
// return 1;
}
}
pub trait QAbstractItemView_setDragEnabled<RetType> {
fn setDragEnabled(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setDragEnabled(bool enable);
impl<'a> /*trait*/ QAbstractItemView_setDragEnabled<()> for (i8) {
fn setDragEnabled(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView14setDragEnabledEb()};
let arg0 = self as c_char;
unsafe {C_ZN17QAbstractItemView14setDragEnabledEb(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QModelIndex QAbstractItemView::currentIndex();
impl /*struct*/ QAbstractItemView {
pub fn currentIndex<RetType, T: QAbstractItemView_currentIndex<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.currentIndex(self);
// return 1;
}
}
pub trait QAbstractItemView_currentIndex<RetType> {
fn currentIndex(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QModelIndex QAbstractItemView::currentIndex();
impl<'a> /*trait*/ QAbstractItemView_currentIndex<QModelIndex> for () {
fn currentIndex(self , rsthis: & QAbstractItemView) -> QModelIndex {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView12currentIndexEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView12currentIndexEv(rsthis.qclsinst)};
let mut ret1 = QModelIndex::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: int QAbstractItemView::sizeHintForRow(int row);
impl /*struct*/ QAbstractItemView {
pub fn sizeHintForRow<RetType, T: QAbstractItemView_sizeHintForRow<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.sizeHintForRow(self);
// return 1;
}
}
pub trait QAbstractItemView_sizeHintForRow<RetType> {
fn sizeHintForRow(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: int QAbstractItemView::sizeHintForRow(int row);
impl<'a> /*trait*/ QAbstractItemView_sizeHintForRow<i32> for (i32) {
fn sizeHintForRow(self , rsthis: & QAbstractItemView) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView14sizeHintForRowEi()};
let arg0 = self as c_int;
let mut ret = unsafe {C_ZNK17QAbstractItemView14sizeHintForRowEi(rsthis.qclsinst, arg0)};
return ret as i32; // 1
// return 1;
}
}
// proto: void QAbstractItemView::QAbstractItemView(QWidget * parent);
impl /*struct*/ QAbstractItemView {
pub fn new<T: QAbstractItemView_new>(value: T) -> QAbstractItemView {
let rsthis = value.new();
return rsthis;
// return 1;
}
}
pub trait QAbstractItemView_new {
fn new(self) -> QAbstractItemView;
}
// proto: void QAbstractItemView::QAbstractItemView(QWidget * parent);
impl<'a> /*trait*/ QAbstractItemView_new for (Option<&'a QWidget>) {
fn new(self) -> QAbstractItemView {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemViewC2EP7QWidget()};
let ctysz: c_int = unsafe{QAbstractItemView_Class_Size()};
let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64;
let arg0 = (if self.is_none() {0} else {self.unwrap().qclsinst}) as *mut c_void;
let qthis: u64 = unsafe {C_ZN17QAbstractItemViewC2EP7QWidget(arg0)};
let rsthis = QAbstractItemView{qbase: QAbstractScrollArea::inheritFrom(qthis), qclsinst: qthis, ..Default::default()};
return rsthis;
// return 1;
}
}
// proto: bool QAbstractItemView::showDropIndicator();
impl /*struct*/ QAbstractItemView {
pub fn showDropIndicator<RetType, T: QAbstractItemView_showDropIndicator<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.showDropIndicator(self);
// return 1;
}
}
pub trait QAbstractItemView_showDropIndicator<RetType> {
fn showDropIndicator(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: bool QAbstractItemView::showDropIndicator();
impl<'a> /*trait*/ QAbstractItemView_showDropIndicator<i8> for () {
fn showDropIndicator(self , rsthis: & QAbstractItemView) -> i8 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView17showDropIndicatorEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView17showDropIndicatorEv(rsthis.qclsinst)};
return ret as i8; // 1
// return 1;
}
}
// proto: bool QAbstractItemView::hasAutoScroll();
impl /*struct*/ QAbstractItemView {
pub fn hasAutoScroll<RetType, T: QAbstractItemView_hasAutoScroll<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.hasAutoScroll(self);
// return 1;
}
}
pub trait QAbstractItemView_hasAutoScroll<RetType> {
fn hasAutoScroll(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: bool QAbstractItemView::hasAutoScroll();
impl<'a> /*trait*/ QAbstractItemView_hasAutoScroll<i8> for () {
fn hasAutoScroll(self , rsthis: & QAbstractItemView) -> i8 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView13hasAutoScrollEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView13hasAutoScrollEv(rsthis.qclsinst)};
return ret as i8; // 1
// return 1;
}
}
// proto: void QAbstractItemView::selectAll();
impl /*struct*/ QAbstractItemView {
pub fn selectAll<RetType, T: QAbstractItemView_selectAll<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.selectAll(self);
// return 1;
}
}
pub trait QAbstractItemView_selectAll<RetType> {
fn selectAll(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::selectAll();
impl<'a> /*trait*/ QAbstractItemView_selectAll<()> for () {
fn selectAll(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView9selectAllEv()};
unsafe {C_ZN17QAbstractItemView9selectAllEv(rsthis.qclsinst)};
// return 1;
}
}
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegate();
impl<'a> /*trait*/ QAbstractItemView_itemDelegate<QAbstractItemDelegate> for () {
fn itemDelegate(self , rsthis: & QAbstractItemView) -> QAbstractItemDelegate {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView12itemDelegateEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView12itemDelegateEv(rsthis.qclsinst)};
let mut ret1 = QAbstractItemDelegate::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::edit(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn edit<RetType, T: QAbstractItemView_edit<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.edit(self);
// return 1;
}
}
pub trait QAbstractItemView_edit<RetType> {
fn edit(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::edit(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_edit<()> for (&'a QModelIndex) {
fn edit(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView4editERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView4editERK11QModelIndex(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::setAlternatingRowColors(bool enable);
impl /*struct*/ QAbstractItemView {
pub fn setAlternatingRowColors<RetType, T: QAbstractItemView_setAlternatingRowColors<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setAlternatingRowColors(self);
// return 1;
}
}
pub trait QAbstractItemView_setAlternatingRowColors<RetType> {
fn setAlternatingRowColors(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setAlternatingRowColors(bool enable);
impl<'a> /*trait*/ QAbstractItemView_setAlternatingRowColors<()> for (i8) {
fn setAlternatingRowColors(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView23setAlternatingRowColorsEb()};
let arg0 = self as c_char;
unsafe {C_ZN17QAbstractItemView23setAlternatingRowColorsEb(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: int QAbstractItemView::sizeHintForColumn(int column);
impl /*struct*/ QAbstractItemView {
pub fn sizeHintForColumn<RetType, T: QAbstractItemView_sizeHintForColumn<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.sizeHintForColumn(self);
// return 1;
}
}
pub trait QAbstractItemView_sizeHintForColumn<RetType> {
fn sizeHintForColumn(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: int QAbstractItemView::sizeHintForColumn(int column);
impl<'a> /*trait*/ QAbstractItemView_sizeHintForColumn<i32> for (i32) {
fn sizeHintForColumn(self , rsthis: & QAbstractItemView) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView17sizeHintForColumnEi()};
let arg0 = self as c_int;
let mut ret = unsafe {C_ZNK17QAbstractItemView17sizeHintForColumnEi(rsthis.qclsinst, arg0)};
return ret as i32; // 1
// return 1;
}
}
// proto: void QAbstractItemView::setIconSize(const QSize & size);
impl /*struct*/ QAbstractItemView {
pub fn setIconSize<RetType, T: QAbstractItemView_setIconSize<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setIconSize(self);
// return 1;
}
}
pub trait QAbstractItemView_setIconSize<RetType> {
fn setIconSize(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setIconSize(const QSize & size);
impl<'a> /*trait*/ QAbstractItemView_setIconSize<()> for (&'a QSize) {
fn setIconSize(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView11setIconSizeERK5QSize()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView11setIconSizeERK5QSize(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::closePersistentEditor(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn closePersistentEditor<RetType, T: QAbstractItemView_closePersistentEditor<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.closePersistentEditor(self);
// return 1;
}
}
pub trait QAbstractItemView_closePersistentEditor<RetType> {
fn closePersistentEditor(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::closePersistentEditor(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_closePersistentEditor<()> for (&'a QModelIndex) {
fn closePersistentEditor(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView21closePersistentEditorERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView21closePersistentEditorERK11QModelIndex(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::setDragDropOverwriteMode(bool overwrite);
impl /*struct*/ QAbstractItemView {
pub fn setDragDropOverwriteMode<RetType, T: QAbstractItemView_setDragDropOverwriteMode<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setDragDropOverwriteMode(self);
// return 1;
}
}
pub trait QAbstractItemView_setDragDropOverwriteMode<RetType> {
fn setDragDropOverwriteMode(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setDragDropOverwriteMode(bool overwrite);
impl<'a> /*trait*/ QAbstractItemView_setDragDropOverwriteMode<()> for (i8) {
fn setDragDropOverwriteMode(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView24setDragDropOverwriteModeEb()};
let arg0 = self as c_char;
unsafe {C_ZN17QAbstractItemView24setDragDropOverwriteModeEb(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::clearSelection();
impl /*struct*/ QAbstractItemView {
pub fn clearSelection<RetType, T: QAbstractItemView_clearSelection<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.clearSelection(self);
// return 1;
}
}
pub trait QAbstractItemView_clearSelection<RetType> {
fn clearSelection(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::clearSelection();
impl<'a> /*trait*/ QAbstractItemView_clearSelection<()> for () {
fn clearSelection(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView14clearSelectionEv()};
unsafe {C_ZN17QAbstractItemView14clearSelectionEv(rsthis.qclsinst)};
// return 1;
}
}
// proto: void QAbstractItemView::scrollToTop();
impl /*struct*/ QAbstractItemView {
pub fn scrollToTop<RetType, T: QAbstractItemView_scrollToTop<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.scrollToTop(self);
// return 1;
}
}
pub trait QAbstractItemView_scrollToTop<RetType> {
fn scrollToTop(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::scrollToTop();
impl<'a> /*trait*/ QAbstractItemView_scrollToTop<()> for () {
fn scrollToTop(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView11scrollToTopEv()};
unsafe {C_ZN17QAbstractItemView11scrollToTopEv(rsthis.qclsinst)};
// return 1;
}
}
// proto: void QAbstractItemView::setSelectionModel(QItemSelectionModel * selectionModel);
impl /*struct*/ QAbstractItemView {
pub fn setSelectionModel<RetType, T: QAbstractItemView_setSelectionModel<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setSelectionModel(self);
// return 1;
}
}
pub trait QAbstractItemView_setSelectionModel<RetType> {
fn setSelectionModel(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setSelectionModel(QItemSelectionModel * selectionModel);
impl<'a> /*trait*/ QAbstractItemView_setSelectionModel<()> for (&'a QItemSelectionModel) {
fn setSelectionModel(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView17setSelectionModelEP19QItemSelectionModel()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView17setSelectionModelEP19QItemSelectionModel(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::setCurrentIndex(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn setCurrentIndex<RetType, T: QAbstractItemView_setCurrentIndex<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setCurrentIndex(self);
// return 1;
}
}
pub trait QAbstractItemView_setCurrentIndex<RetType> {
fn setCurrentIndex(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setCurrentIndex(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_setCurrentIndex<()> for (&'a QModelIndex) {
fn setCurrentIndex(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView15setCurrentIndexERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView15setCurrentIndexERK11QModelIndex(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QModelIndex QAbstractItemView::indexAt(const QPoint & point);
impl /*struct*/ QAbstractItemView {
pub fn indexAt<RetType, T: QAbstractItemView_indexAt<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.indexAt(self);
// return 1;
}
}
pub trait QAbstractItemView_indexAt<RetType> {
fn indexAt(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QModelIndex QAbstractItemView::indexAt(const QPoint & point);
impl<'a> /*trait*/ QAbstractItemView_indexAt<QModelIndex> for (&'a QPoint) {
fn indexAt(self , rsthis: & QAbstractItemView) -> QModelIndex {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView7indexAtERK6QPoint()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK17QAbstractItemView7indexAtERK6QPoint(rsthis.qclsinst, arg0)};
let mut ret1 = QModelIndex::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::setTabKeyNavigation(bool enable);
impl /*struct*/ QAbstractItemView {
pub fn setTabKeyNavigation<RetType, T: QAbstractItemView_setTabKeyNavigation<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setTabKeyNavigation(self);
// return 1;
}
}
pub trait QAbstractItemView_setTabKeyNavigation<RetType> {
fn setTabKeyNavigation(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setTabKeyNavigation(bool enable);
impl<'a> /*trait*/ QAbstractItemView_setTabKeyNavigation<()> for (i8) {
fn setTabKeyNavigation(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView19setTabKeyNavigationEb()};
let arg0 = self as c_char;
unsafe {C_ZN17QAbstractItemView19setTabKeyNavigationEb(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::setIndexWidget(const QModelIndex & index, QWidget * widget);
impl /*struct*/ QAbstractItemView {
pub fn setIndexWidget<RetType, T: QAbstractItemView_setIndexWidget<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setIndexWidget(self);
// return 1;
}
}
pub trait QAbstractItemView_setIndexWidget<RetType> {
fn setIndexWidget(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setIndexWidget(const QModelIndex & index, QWidget * widget);
impl<'a> /*trait*/ QAbstractItemView_setIndexWidget<()> for (&'a QModelIndex, &'a QWidget) {
fn setIndexWidget(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView14setIndexWidgetERK11QModelIndexP7QWidget()};
let arg0 = self.0.qclsinst as *mut c_void;
let arg1 = self.1.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView14setIndexWidgetERK11QModelIndexP7QWidget(rsthis.qclsinst, arg0, arg1)};
// return 1;
}
}
// proto: void QAbstractItemView::setAutoScroll(bool enable);
impl /*struct*/ QAbstractItemView {
pub fn setAutoScroll<RetType, T: QAbstractItemView_setAutoScroll<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setAutoScroll(self);
// return 1;
}
}
pub trait QAbstractItemView_setAutoScroll<RetType> {
fn setAutoScroll(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setAutoScroll(bool enable);
impl<'a> /*trait*/ QAbstractItemView_setAutoScroll<()> for (i8) {
fn setAutoScroll(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView13setAutoScrollEb()};
let arg0 = self as c_char;
unsafe {C_ZN17QAbstractItemView13setAutoScrollEb(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::setModel(QAbstractItemModel * model);
impl /*struct*/ QAbstractItemView {
pub fn setModel<RetType, T: QAbstractItemView_setModel<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setModel(self);
// return 1;
}
}
pub trait QAbstractItemView_setModel<RetType> {
fn setModel(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::setModel(QAbstractItemModel * model);
impl<'a> /*trait*/ QAbstractItemView_setModel<()> for (&'a QAbstractItemModel) {
fn setModel(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView8setModelEP18QAbstractItemModel()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView8setModelEP18QAbstractItemModel(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QAbstractItemView::update(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn update<RetType, T: QAbstractItemView_update<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.update(self);
// return 1;
}
}
pub trait QAbstractItemView_update<RetType> {
fn update(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::update(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_update<()> for (&'a QModelIndex) {
fn update(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView6updateERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView6updateERK11QModelIndex(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: const QMetaObject * QAbstractItemView::metaObject();
impl /*struct*/ QAbstractItemView {
pub fn metaObject<RetType, T: QAbstractItemView_metaObject<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.metaObject(self);
// return 1;
}
}
pub trait QAbstractItemView_metaObject<RetType> {
fn metaObject(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: const QMetaObject * QAbstractItemView::metaObject();
impl<'a> /*trait*/ QAbstractItemView_metaObject<QMetaObject> for () {
fn metaObject(self , rsthis: & QAbstractItemView) -> QMetaObject {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView10metaObjectEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView10metaObjectEv(rsthis.qclsinst)};
let mut ret1 = QMetaObject::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractItemView::openPersistentEditor(const QModelIndex & index);
impl /*struct*/ QAbstractItemView {
pub fn openPersistentEditor<RetType, T: QAbstractItemView_openPersistentEditor<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.openPersistentEditor(self);
// return 1;
}
}
pub trait QAbstractItemView_openPersistentEditor<RetType> {
fn openPersistentEditor(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: void QAbstractItemView::openPersistentEditor(const QModelIndex & index);
impl<'a> /*trait*/ QAbstractItemView_openPersistentEditor<()> for (&'a QModelIndex) {
fn openPersistentEditor(self , rsthis: & QAbstractItemView) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN17QAbstractItemView20openPersistentEditorERK11QModelIndex()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN17QAbstractItemView20openPersistentEditorERK11QModelIndex(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegateForRow(int row);
impl /*struct*/ QAbstractItemView {
pub fn itemDelegateForRow<RetType, T: QAbstractItemView_itemDelegateForRow<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.itemDelegateForRow(self);
// return 1;
}
}
pub trait QAbstractItemView_itemDelegateForRow<RetType> {
fn itemDelegateForRow(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: QAbstractItemDelegate * QAbstractItemView::itemDelegateForRow(int row);
impl<'a> /*trait*/ QAbstractItemView_itemDelegateForRow<QAbstractItemDelegate> for (i32) {
fn itemDelegateForRow(self , rsthis: & QAbstractItemView) -> QAbstractItemDelegate {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView18itemDelegateForRowEi()};
let arg0 = self as c_int;
let mut ret = unsafe {C_ZNK17QAbstractItemView18itemDelegateForRowEi(rsthis.qclsinst, arg0)};
let mut ret1 = QAbstractItemDelegate::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: bool QAbstractItemView::dragDropOverwriteMode();
impl /*struct*/ QAbstractItemView {
pub fn dragDropOverwriteMode<RetType, T: QAbstractItemView_dragDropOverwriteMode<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.dragDropOverwriteMode(self);
// return 1;
}
}
pub trait QAbstractItemView_dragDropOverwriteMode<RetType> {
fn dragDropOverwriteMode(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: bool QAbstractItemView::dragDropOverwriteMode();
impl<'a> /*trait*/ QAbstractItemView_dragDropOverwriteMode<i8> for () {
fn dragDropOverwriteMode(self , rsthis: & QAbstractItemView) -> i8 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView21dragDropOverwriteModeEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView21dragDropOverwriteModeEv(rsthis.qclsinst)};
return ret as i8; // 1
// return 1;
}
}
// proto: bool QAbstractItemView::tabKeyNavigation();
impl /*struct*/ QAbstractItemView {
pub fn tabKeyNavigation<RetType, T: QAbstractItemView_tabKeyNavigation<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.tabKeyNavigation(self);
// return 1;
}
}
pub trait QAbstractItemView_tabKeyNavigation<RetType> {
fn tabKeyNavigation(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: bool QAbstractItemView::tabKeyNavigation();
impl<'a> /*trait*/ QAbstractItemView_tabKeyNavigation<i8> for () {
fn tabKeyNavigation(self , rsthis: & QAbstractItemView) -> i8 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView16tabKeyNavigationEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView16tabKeyNavigationEv(rsthis.qclsinst)};
return ret as i8; // 1
// return 1;
}
}
// proto: int QAbstractItemView::autoScrollMargin();
impl /*struct*/ QAbstractItemView {
pub fn autoScrollMargin<RetType, T: QAbstractItemView_autoScrollMargin<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.autoScrollMargin(self);
// return 1;
}
}
pub trait QAbstractItemView_autoScrollMargin<RetType> {
fn autoScrollMargin(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: int QAbstractItemView::autoScrollMargin();
impl<'a> /*trait*/ QAbstractItemView_autoScrollMargin<i32> for () {
fn autoScrollMargin(self , rsthis: & QAbstractItemView) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView16autoScrollMarginEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView16autoScrollMarginEv(rsthis.qclsinst)};
return ret as i32; // 1
// return 1;
}
}
// proto: bool QAbstractItemView::alternatingRowColors();
impl /*struct*/ QAbstractItemView {
pub fn alternatingRowColors<RetType, T: QAbstractItemView_alternatingRowColors<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.alternatingRowColors(self);
// return 1;
}
}
pub trait QAbstractItemView_alternatingRowColors<RetType> {
fn alternatingRowColors(self , rsthis: & QAbstractItemView) -> RetType;
}
// proto: bool QAbstractItemView::alternatingRowColors();
impl<'a> /*trait*/ QAbstractItemView_alternatingRowColors<i8> for () {
fn alternatingRowColors(self , rsthis: & QAbstractItemView) -> i8 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK17QAbstractItemView20alternatingRowColorsEv()};
let mut ret = unsafe {C_ZNK17QAbstractItemView20alternatingRowColorsEv(rsthis.qclsinst)};
return ret as i8; // 1
// return 1;
}
}
#[derive(Default)] // for QAbstractItemView_iconSizeChanged
pub struct QAbstractItemView_iconSizeChanged_signal{poi:u64}
impl /* struct */ QAbstractItemView {
pub fn iconSizeChanged(&self) -> QAbstractItemView_iconSizeChanged_signal {
return QAbstractItemView_iconSizeChanged_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractItemView_iconSizeChanged_signal {
pub fn connect<T: QAbstractItemView_iconSizeChanged_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractItemView_iconSizeChanged_signal_connect {
fn connect(self, sigthis: QAbstractItemView_iconSizeChanged_signal);
}
#[derive(Default)] // for QAbstractItemView_clicked
pub struct QAbstractItemView_clicked_signal{poi:u64}
impl /* struct */ QAbstractItemView {
pub fn clicked(&self) -> QAbstractItemView_clicked_signal {
return QAbstractItemView_clicked_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractItemView_clicked_signal {
pub fn connect<T: QAbstractItemView_clicked_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractItemView_clicked_signal_connect {
fn connect(self, sigthis: QAbstractItemView_clicked_signal);
}
#[derive(Default)] // for QAbstractItemView_viewportEntered
pub struct QAbstractItemView_viewportEntered_signal{poi:u64}
impl /* struct */ QAbstractItemView {
pub fn viewportEntered(&self) -> QAbstractItemView_viewportEntered_signal {
return QAbstractItemView_viewportEntered_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractItemView_viewportEntered_signal {
pub fn connect<T: QAbstractItemView_viewportEntered_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractItemView_viewportEntered_signal_connect {
fn connect(self, sigthis: QAbstractItemView_viewportEntered_signal);
}
#[derive(Default)] // for QAbstractItemView_activated
pub struct QAbstractItemView_activated_signal{poi:u64}
impl /* struct */ QAbstractItemView {
pub fn activated(&self) -> QAbstractItemView_activated_signal {
return QAbstractItemView_activated_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractItemView_activated_signal {
pub fn connect<T: QAbstractItemView_activated_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractItemView_activated_signal_connect {
fn connect(self, sigthis: QAbstractItemView_activated_signal);
}
#[derive(Default)] // for QAbstractItemView_pressed
pub struct QAbstractItemView_pressed_signal{poi:u64}
impl /* struct */ QAbstractItemView {
pub fn pressed(&self) -> QAbstractItemView_pressed_signal {
return QAbstractItemView_pressed_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractItemView_pressed_signal {
pub fn connect<T: QAbstractItemView_pressed_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractItemView_pressed_signal_connect {
fn connect(self, sigthis: QAbstractItemView_pressed_signal);
}
#[derive(Default)] // for QAbstractItemView_entered
pub struct QAbstractItemView_entered_signal{poi:u64}
impl /* struct */ QAbstractItemView {
pub fn entered(&self) -> QAbstractItemView_entered_signal {
return QAbstractItemView_entered_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractItemView_entered_signal {
pub fn connect<T: QAbstractItemView_entered_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractItemView_entered_signal_connect {
fn connect(self, sigthis: QAbstractItemView_entered_signal);
}
#[derive(Default)] // for QAbstractItemView_doubleClicked
pub struct QAbstractItemView_doubleClicked_signal{poi:u64}
impl /* struct */ QAbstractItemView {
pub fn doubleClicked(&self) -> QAbstractItemView_doubleClicked_signal {
return QAbstractItemView_doubleClicked_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractItemView_doubleClicked_signal {
pub fn connect<T: QAbstractItemView_doubleClicked_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractItemView_doubleClicked_signal_connect {
fn connect(self, sigthis: QAbstractItemView_doubleClicked_signal);
}
// entered(const class QModelIndex &)
extern fn QAbstractItemView_entered_signal_connect_cb_0(rsfptr:fn(QModelIndex), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QAbstractItemView_entered_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(QModelIndex)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractItemView_entered_signal_connect for fn(QModelIndex) {
fn connect(self, sigthis: QAbstractItemView_entered_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_entered_signal_connect_cb_0 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7enteredERK11QModelIndex(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractItemView_entered_signal_connect for Box<Fn(QModelIndex)> {
fn connect(self, sigthis: QAbstractItemView_entered_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_entered_signal_connect_cb_box_0 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7enteredERK11QModelIndex(arg0, arg1, arg2)};
}
}
// doubleClicked(const class QModelIndex &)
extern fn QAbstractItemView_doubleClicked_signal_connect_cb_1(rsfptr:fn(QModelIndex), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QAbstractItemView_doubleClicked_signal_connect_cb_box_1(rsfptr_raw:*mut Box<Fn(QModelIndex)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractItemView_doubleClicked_signal_connect for fn(QModelIndex) {
fn connect(self, sigthis: QAbstractItemView_doubleClicked_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_doubleClicked_signal_connect_cb_1 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView13doubleClickedERK11QModelIndex(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractItemView_doubleClicked_signal_connect for Box<Fn(QModelIndex)> {
fn connect(self, sigthis: QAbstractItemView_doubleClicked_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_doubleClicked_signal_connect_cb_box_1 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView13doubleClickedERK11QModelIndex(arg0, arg1, arg2)};
}
}
// pressed(const class QModelIndex &)
extern fn QAbstractItemView_pressed_signal_connect_cb_2(rsfptr:fn(QModelIndex), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QAbstractItemView_pressed_signal_connect_cb_box_2(rsfptr_raw:*mut Box<Fn(QModelIndex)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractItemView_pressed_signal_connect for fn(QModelIndex) {
fn connect(self, sigthis: QAbstractItemView_pressed_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_pressed_signal_connect_cb_2 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7pressedERK11QModelIndex(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractItemView_pressed_signal_connect for Box<Fn(QModelIndex)> {
fn connect(self, sigthis: QAbstractItemView_pressed_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_pressed_signal_connect_cb_box_2 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7pressedERK11QModelIndex(arg0, arg1, arg2)};
}
}
// viewportEntered()
extern fn QAbstractItemView_viewportEntered_signal_connect_cb_3(rsfptr:fn(), ) {
println!("{}:{}", file!(), line!());
rsfptr();
}
extern fn QAbstractItemView_viewportEntered_signal_connect_cb_box_3(rsfptr_raw:*mut Box<Fn()>, ) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
// rsfptr();
unsafe{(*rsfptr_raw)()};
}
impl /* trait */ QAbstractItemView_viewportEntered_signal_connect for fn() {
fn connect(self, sigthis: QAbstractItemView_viewportEntered_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_viewportEntered_signal_connect_cb_3 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView15viewportEnteredEv(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractItemView_viewportEntered_signal_connect for Box<Fn()> {
fn connect(self, sigthis: QAbstractItemView_viewportEntered_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_viewportEntered_signal_connect_cb_box_3 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView15viewportEnteredEv(arg0, arg1, arg2)};
}
}
// iconSizeChanged(const class QSize &)
extern fn QAbstractItemView_iconSizeChanged_signal_connect_cb_4(rsfptr:fn(QSize), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QSize::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QAbstractItemView_iconSizeChanged_signal_connect_cb_box_4(rsfptr_raw:*mut Box<Fn(QSize)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QSize::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractItemView_iconSizeChanged_signal_connect for fn(QSize) {
fn connect(self, sigthis: QAbstractItemView_iconSizeChanged_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_iconSizeChanged_signal_connect_cb_4 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView15iconSizeChangedERK5QSize(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractItemView_iconSizeChanged_signal_connect for Box<Fn(QSize)> {
fn connect(self, sigthis: QAbstractItemView_iconSizeChanged_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_iconSizeChanged_signal_connect_cb_box_4 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView15iconSizeChangedERK5QSize(arg0, arg1, arg2)};
}
}
// activated(const class QModelIndex &)
extern fn QAbstractItemView_activated_signal_connect_cb_5(rsfptr:fn(QModelIndex), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QAbstractItemView_activated_signal_connect_cb_box_5(rsfptr_raw:*mut Box<Fn(QModelIndex)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractItemView_activated_signal_connect for fn(QModelIndex) {
fn connect(self, sigthis: QAbstractItemView_activated_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_activated_signal_connect_cb_5 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView9activatedERK11QModelIndex(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractItemView_activated_signal_connect for Box<Fn(QModelIndex)> {
fn connect(self, sigthis: QAbstractItemView_activated_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_activated_signal_connect_cb_box_5 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView9activatedERK11QModelIndex(arg0, arg1, arg2)};
}
}
// clicked(const class QModelIndex &)
extern fn QAbstractItemView_clicked_signal_connect_cb_6(rsfptr:fn(QModelIndex), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QAbstractItemView_clicked_signal_connect_cb_box_6(rsfptr_raw:*mut Box<Fn(QModelIndex)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QModelIndex::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractItemView_clicked_signal_connect for fn(QModelIndex) {
fn connect(self, sigthis: QAbstractItemView_clicked_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_clicked_signal_connect_cb_6 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7clickedERK11QModelIndex(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractItemView_clicked_signal_connect for Box<Fn(QModelIndex)> {
fn connect(self, sigthis: QAbstractItemView_clicked_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractItemView_clicked_signal_connect_cb_box_6 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractItemView_SlotProxy_connect__ZN17QAbstractItemView7clickedERK11QModelIndex(arg0, arg1, arg2)};
}
}
// <= body block end
|
use std::fs;
#[derive(Debug)]
struct Files(String, String);
fn main() {
// paths mengembalikan iterator dari std::fs:DirEntry
let paths = fs::read_dir(r#"/run/media/susilo/381ed80f-3b52-4756-8881-9b77edc118ca/Backup Phone/susilo/DCIM/Camera"#).unwrap();
let f = vec![
String::from("/run/media/susilo/381ed80f-3b52-4756-8881-9b77edc118ca/Backup Phone/susilo/DCIM/Camera/IMG_20190727_173729.jpg"),
String::from("/run/media/susilo/381ed80f-3b52-4756-8881-9b77edc118ca/Backup Phone/susilo/DCIM/Camera/IMG_20190821_222241.jpg")
];
let p = paths
.filter_map(Result::ok)
.fold(Vec::new(), |mut acc, x| {
acc.push(x.path().display().to_string());
acc
})
.iter()
.filter(|x| !f.contains(&x))
.for_each(|x| {
println!("{}", x)
});
// for path in paths {
// path.unwrap() mengembalikan PathBuf
// V
// println!("Name: {}", path.unwrap().path().display());
// ^
// display() dari impl PathBuf
// }
}
|
use crate::sim::*;
pub struct NaiveBinarySearch {
lo: usize,
hi: usize,
memory: Memory,
}
struct Retry {
commit: usize,
remaining_retries: usize,
}
enum Memory {
PreviousLows(Vec<usize>),
Retry {
max_retries: usize,
active_retry: Option<Retry>,
},
BlissfulIgnorance,
}
// mistrustful(3) == will run each passing commit 4 times before moving on
// mistrustful(0) is equivalent to forgeteverything
pub enum ConfusedHumanMode {
ForgetEverything,
UsePreviousLow,
Mistrustful(usize)
}
impl NaiveBinarySearch {
pub fn new(s: &SimulationState, how: ConfusedHumanMode) -> Self {
Self {
lo: 0,
hi: s.pdf.len() - 1,
memory: match how {
ConfusedHumanMode::ForgetEverything => Memory::BlissfulIgnorance,
ConfusedHumanMode::UsePreviousLow => Memory::PreviousLows(vec![]),
ConfusedHumanMode::Mistrustful(max_retries) => {
assert_ne!(max_retries, 0, "just use ForgetEverything in this case");
if s.false_negative_rate == 0.0 {
// don't bother retrying commits in this mode, obviously
// Memory::BlissfulIgnorance
Memory::Retry { max_retries, active_retry: None }
} else {
Memory::Retry { max_retries, active_retry: None }
}
},
},
}
}
}
impl BisectStrategy for NaiveBinarySearch {
fn name(&self) -> String {
match self.memory {
Memory::PreviousLows(_) => "naive_memory".to_string(),
Memory::Retry { max_retries, .. } => format!("naive_mistrustful_{}", max_retries),
Memory::BlissfulIgnorance => "naive_forgetful".to_string(),
}
}
fn select_commit(&mut self, _s: &SimulationState) -> usize {
if let Memory::Retry { active_retry: Some(ref retry), .. } = self.memory {
retry.commit
} else if self.lo == self.hi {
assert_ne!(self.lo, 0, "ok, but the bug has to be at 0 now yo");
// human thinks they found the bug. keep poking to increase confidence.
self.lo - 1
} else {
(self.lo + self.hi) / 2
}
}
fn notify_result(&mut self, result: BisectAttempt) {
if result.bug_repros {
self.hi = result.commit;
if self.hi < self.lo {
assert_eq!(self.hi, self.lo - 1, "whoa, got too excited there");
// human realizes theyre in the twilight zone.
// the current lower bound was a lie! discard it and rewind a lil.
self.lo = match self.memory {
Memory::Retry { .. } | Memory::BlissfulIgnorance => 0,
Memory::PreviousLows(ref mut previous_lows) => {
previous_lows.pop().expect("impossible, bug before 0")
},
};
assert!(self.lo <= self.hi, "too many duplicate previous lows");
}
if let Memory::Retry { ref mut active_retry, .. } = self.memory {
*active_retry = None;
}
} else {
assert!(result.commit + 1 >= self.lo, "whoa, got too excited there");
match self.memory {
Memory::PreviousLows(ref mut previous_lows) => {
if result.commit + 1 > self.lo {
previous_lows.push(self.lo);
self.lo = result.commit + 1;
}
},
Memory::Retry { ref mut active_retry, max_retries } => {
if let Some(ref mut retry) = active_retry {
assert_eq!(retry.commit, result.commit, "deviated");
assert!(retry.remaining_retries > 0);
retry.remaining_retries -= 1;
if retry.remaining_retries == 0 {
drop(retry);
*active_retry = None;
self.lo = result.commit + 1;
}
} else {
*active_retry = Some(Retry {
commit: result.commit,
remaining_retries: max_retries,
});
}
},
Memory::BlissfulIgnorance => {
self.lo = result.commit + 1;
},
}
}
}
}
#[cfg(test)]
mod tests {
use super::*;
impl NaiveBinarySearch {
fn probe_assert(&mut self, s: &SimulationState, commit: usize,
bug_repros: bool, expected_lo: usize, expected_hi: usize)
{
assert_eq!(self.select_commit(s), commit);
self.notify_result(BisectAttempt { commit, bug_repros });
assert_eq!(self.lo, expected_lo);
assert_eq!(self.hi, expected_hi);
}
fn probe_assert_retry(&mut self, s: &SimulationState, commit: usize,
retries: usize, expected_lo: usize, expected_hi: usize)
{
for _ in 0..retries {
// self.lo doesn't update until retries runs out
self.probe_assert(s, commit, false, self.lo, expected_hi);
}
self.probe_assert(s, commit, false, expected_lo, expected_hi);
}
fn unwrap_previous_lows(&self) -> &Vec<usize> {
if let Memory::PreviousLows(ref memory) = self.memory {
memory
} else {
panic!("expected previous lows mode here");
}
}
fn unwrap_active_retry(&self) -> Option<&Retry> {
if let Memory::Retry { ref active_retry, .. } = self.memory {
active_retry.as_ref()
} else {
panic!("expected mistrustful mode here");
}
}
}
#[test]
fn test_naive_basic() {
// we'll say the bug is secretly at 5
// we just need this to make `b` initialize its `hi`
let s = SimulationState::new(8, 0.0);
let mut b = NaiveBinarySearch::new(&s, ConfusedHumanMode::ForgetEverything);
b.probe_assert(&s, 3, false, 4, 7);
b.probe_assert(&s, 5, true, 4, 5);
b.probe_assert(&s, 4, false, 5, 5);
}
fn setup_contradiction_test(how: ConfusedHumanMode)
-> (SimulationState, NaiveBinarySearch)
{
let retries = if let ConfusedHumanMode::Mistrustful(n) = how { n } else { 0 };
// need to have nonzero fnrate here for mistrustful to do its retries
let s = SimulationState::new(8, 0.5);
let mut b = NaiveBinarySearch::new(&s, how);
// push the human to the end of the range with some negative flakes.
b.probe_assert_retry(&s, 3, retries, 4, 7);
b.probe_assert_retry(&s, 5, retries, 6, 7);
b.probe_assert_retry(&s, 6, retries, 7, 7);
(s, b)
}
#[test]
fn test_naive_contradiction_forget() {
let (s, mut b) = setup_contradiction_test(ConfusedHumanMode::ForgetEverything);
// now, asked to confirm, the human probes 6 to increase confidence on 7
// they realize something is up, and reset their lower bound to start over.
b.probe_assert(&s, 6, true, 0, 6);
// it isn't interesting to test further since there's no persistent state
}
#[test]
fn test_naive_contradiction_rewind() {
let (s, mut b) = setup_contradiction_test(ConfusedHumanMode::UsePreviousLow);
b.probe_assert(&s, 6, true, 6, 6);
// the human, who now has perfect memory, walks backwards in time
b.probe_assert(&s, 5, true, 4, 5);
b.probe_assert(&s, 4, true, 4, 4);
b.probe_assert(&s, 3, true, 0, 3);
// now they are truly in the twilight zone!
assert!(b.unwrap_previous_lows().is_empty());
}
#[test]
fn test_naive_contradiction_mistrustful() {
for retries in 1..8 {
let (s, mut b) = setup_contradiction_test(ConfusedHumanMode::Mistrustful(retries));
// should behave the same way as forgetful mode when the bug does repro
b.probe_assert(&s, 6, true, 0, 6);
// let's say the bug is at 0 but we get some flakes
// human should not update their low quite yet
b.probe_assert(&s, 3, false, 0, 6);
let retry = b.unwrap_active_retry().expect("retry should exist");
assert!(retry.remaining_retries == retries);
// now show them the bug
b.probe_assert(&s, 3, true, 0, 3);
// they should forget about their active retry
assert!(b.unwrap_active_retry().is_none());
// etc.
}
}
}
|
/// The current state of the keyboard modifiers.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ModifiersState {
/// Whether a shift key is pressed
pub shift: bool,
/// Whether a control key is pressed
pub control: bool,
/// Whether an alt key is pressed
pub alt: bool,
/// Whether a logo key is pressed (e.g. windows key, command key...)
pub logo: bool,
}
|
#[doc = "Reader of register C12BNDTR"]
pub type R = crate::R<u32, super::C12BNDTR>;
#[doc = "Writer for register C12BNDTR"]
pub type W = crate::W<u32, super::C12BNDTR>;
#[doc = "Register C12BNDTR `reset()`'s with value 0"]
impl crate::ResetValue for super::C12BNDTR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `BNDT`"]
pub type BNDT_R = crate::R<u32, u32>;
#[doc = "Write proxy for field `BNDT`"]
pub struct BNDT_W<'a> {
w: &'a mut W,
}
impl<'a> BNDT_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0001_ffff) | ((value as u32) & 0x0001_ffff);
self.w
}
}
#[doc = "Reader of field `BRSUM`"]
pub type BRSUM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `BRSUM`"]
pub struct BRSUM_W<'a> {
w: &'a mut W,
}
impl<'a> BRSUM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18);
self.w
}
}
#[doc = "Reader of field `BRDUM`"]
pub type BRDUM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `BRDUM`"]
pub struct BRDUM_W<'a> {
w: &'a mut W,
}
impl<'a> BRDUM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 19)) | (((value as u32) & 0x01) << 19);
self.w
}
}
#[doc = "Reader of field `BRC`"]
pub type BRC_R = crate::R<u16, u16>;
#[doc = "Write proxy for field `BRC`"]
pub struct BRC_W<'a> {
w: &'a mut W,
}
impl<'a> BRC_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u16) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x0fff << 20)) | (((value as u32) & 0x0fff) << 20);
self.w
}
}
impl R {
#[doc = "Bits 0:16 - block number of data to transfer"]
#[inline(always)]
pub fn bndt(&self) -> BNDT_R {
BNDT_R::new((self.bits & 0x0001_ffff) as u32)
}
#[doc = "Bit 18 - Block Repeat Source address Update Mode These bits are protected and can be written only if EN is 0."]
#[inline(always)]
pub fn brsum(&self) -> BRSUM_R {
BRSUM_R::new(((self.bits >> 18) & 0x01) != 0)
}
#[doc = "Bit 19 - Block Repeat Destination address Update Mode These bits are protected and can be written only if EN is 0."]
#[inline(always)]
pub fn brdum(&self) -> BRDUM_R {
BRDUM_R::new(((self.bits >> 19) & 0x01) != 0)
}
#[doc = "Bits 20:31 - Block Repeat Count This field contains the number of repetitions of the current block (0 to 4095). When the channel is enabled, this register is read-only, indicating the remaining number of blocks, excluding the current one. This register decrements after each complete block transfer. Once the last block transfer has completed, this register can either stay at zero or be reloaded automatically from memory (in Linked List mode - i.e. Link Address valid). These bits are protected and can be written only if EN is 0."]
#[inline(always)]
pub fn brc(&self) -> BRC_R {
BRC_R::new(((self.bits >> 20) & 0x0fff) as u16)
}
}
impl W {
#[doc = "Bits 0:16 - block number of data to transfer"]
#[inline(always)]
pub fn bndt(&mut self) -> BNDT_W {
BNDT_W { w: self }
}
#[doc = "Bit 18 - Block Repeat Source address Update Mode These bits are protected and can be written only if EN is 0."]
#[inline(always)]
pub fn brsum(&mut self) -> BRSUM_W {
BRSUM_W { w: self }
}
#[doc = "Bit 19 - Block Repeat Destination address Update Mode These bits are protected and can be written only if EN is 0."]
#[inline(always)]
pub fn brdum(&mut self) -> BRDUM_W {
BRDUM_W { w: self }
}
#[doc = "Bits 20:31 - Block Repeat Count This field contains the number of repetitions of the current block (0 to 4095). When the channel is enabled, this register is read-only, indicating the remaining number of blocks, excluding the current one. This register decrements after each complete block transfer. Once the last block transfer has completed, this register can either stay at zero or be reloaded automatically from memory (in Linked List mode - i.e. Link Address valid). These bits are protected and can be written only if EN is 0."]
#[inline(always)]
pub fn brc(&mut self) -> BRC_W {
BRC_W { w: self }
}
}
|
//! Tests auto-converted from "sass-spec/spec/libsass/error-directive-nested"
#[allow(unused)]
use super::rsass;
#[allow(unused)]
use rsass::precision;
// Ignoring "function", tests with expected error not implemented yet.
// Ignoring "inline", tests with expected error not implemented yet.
// Ignoring "mixin", tests with expected error not implemented yet.
|
// Copyright 2017 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
extern crate base64;
extern crate chrono;
#[macro_use]
extern crate clap;
#[macro_use]
extern crate value_derive;
#[macro_use]
extern crate error_chain;
extern crate github_rs;
extern crate handlebars_iron;
extern crate iron;
#[macro_use]
extern crate log;
extern crate loggerv;
#[macro_use]
extern crate nom;
extern crate params;
extern crate persistent;
extern crate regex;
extern crate router;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
extern crate serde_yaml;
extern crate snap;
mod config;
mod errors;
mod expr;
mod github;
mod routes;
mod worker;
use clap::{Arg, App};
use errors::*;
use handlebars_iron::{DirectorySource, HandlebarsEngine};
use iron::prelude::*;
use router::Router;
use std::str::FromStr;
quick_main!(run);
fn run() -> Result<()> {
let args = App::new(crate_name!())
.version(crate_version!())
.about(crate_description!())
.arg(
Arg::with_name("ADDRESS")
.short("a")
.long("address")
.takes_value(true)
.help("The address on which to listen")
.default_value("0.0.0.0"),
)
.arg(
Arg::with_name("PORT")
.short("p")
.long("port")
.takes_value(true)
.help("The port on which to bind")
.default_value("8080"),
)
.arg(
Arg::with_name("SERVER")
.short("s")
.long("server-address")
.takes_value(true)
.help("The server address of the instance")
.default_value("localhost:8080"),
)
.arg(
Arg::with_name("TEMPLATES")
.short("m")
.long("templates")
.takes_value(true)
.help(
"The path to the templates, relative to the working directory",
)
.default_value("assets/templates"),
)
.arg(
Arg::with_name("TOKEN")
.short("t")
.long("token")
.takes_value(true)
.required(true)
.help("The GitHub access token to use for requests"),
)
.arg(
Arg::with_name("VERBOSITY")
.short("v")
.long("verbose")
.multiple(true)
.help("The level of verbosity"),
)
.get_matches();
loggerv::init_with_verbosity(args.occurrences_of("VERBOSITY")).unwrap();
let address = args.value_of("ADDRESS").expect("address flag");
let port = u16::from_str(args.value_of("PORT").expect("port flag"))
.chain_err(|| "Failed to parse port")?;
debug!("Spawning worker thread");
let worker = worker::spawn(
args.value_of("TOKEN").expect("token").to_string(),
args.value_of("SERVER").expect("server").to_string(),
).chain_err(|| "Failed to create status worker")?;
let mut router = Router::new();
router.post("/hook", routes::handle_event, "github_webhook");
router.get("/status", routes::handle_status, "status");
let mut engine = HandlebarsEngine::new();
engine.add(Box::new(DirectorySource::new(
args.value_of("TEMPLATES").expect("templates"),
".hbs",
)));
engine.reload().chain_err(
|| "Failed to start templating engine",
)?;
let mut chain = Chain::new(router);
chain.link(persistent::Write::<worker::Worker>::both(worker));
chain.link_after(engine);
debug!("Starting web server");
Iron::new(chain)
.http((address, port))
.chain_err(|| "Could not start server")
.map(|_| ())
}
|
use crate::{bed::BedDataLine, bedgraph::BedGraphDataLine, util::Strand};
use num::Float;
use std::{
fs::{File, OpenOptions},
io::{BufWriter, Write},
};
pub struct BedWriter {
path: String,
writer: BufWriter<File>,
num_lines_written: i64,
}
impl BedWriter {
pub fn new(path: &str) -> Result<Self, std::io::Error> {
let file = OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(path)?;
let path_buf = std::fs::canonicalize(path)?;
Ok(BedWriter {
path: path_buf.to_str().unwrap().to_string(),
writer: BufWriter::new(file),
num_lines_written: 0,
})
}
pub fn canonical_path(&self) -> &str {
&self.path
}
pub fn write_bed_line<D: Float + std::fmt::Display>(
&mut self,
data: &BedDataLine<D>,
) -> std::io::Result<usize> {
let mut line = format!("{}\t{}\t{}", data.chrom, data.start, data.end);
match &data.name {
None => line.push_str(&format!("\tid_{}", self.num_lines_written)),
Some(name) => line.push_str(&format!("\t{}", name)),
};
match data.score {
None => line.push_str("\t0"),
Some(score) => line.push_str(&format!("\t{}", score)),
}
match data.strand {
None => line.push_str("\t."),
Some(strand) => match strand {
Strand::Positive => {
line.push_str("\t+");
}
Strand::Negative => {
line.push_str("\t-");
}
},
}
line.push_str("\n");
self.num_lines_written += 1;
self.writer.write(line.as_bytes())
}
pub fn write_bedgraph_line<D: Float + std::fmt::Display>(
&mut self,
data: &BedGraphDataLine<D>,
) -> std::io::Result<usize> {
let line = format!(
"{}\t{}\t{}\t{}\n",
data.chrom, data.start, data.end_exclusive, data.value
);
self.num_lines_written += 1;
self.writer.write(line.as_bytes())
}
}
#[cfg(test)]
mod tests {
use crate::{
bed::{bed_writer::BedWriter, Bed, BedDataLine},
bedgraph::{BedGraph, BedGraphDataLine, BedGraphDataLineIter},
util::Strand,
};
use math::traits::ToIterator;
use num::Num;
use tempfile::NamedTempFile;
#[test]
fn test_bed_writer() {
let data_lines = vec![
BedDataLine {
chrom: "chr1".into(),
start: 0,
end: 20,
name: None,
score: Some(9.),
strand: None,
},
BedDataLine {
chrom: "chr1".into(),
start: 10,
end: 50,
name: Some("some_id".into()),
score: None::<f64>,
strand: Some(Strand::Positive),
},
BedDataLine {
chrom: "chr2".into(),
start: 0,
end: 100,
name: None,
score: Some(10.),
strand: Some(Strand::Negative),
},
];
let file = NamedTempFile::new().unwrap();
let path = file.into_temp_path();
{
let mut writer = BedWriter::new(path.to_str().unwrap()).unwrap();
for data in data_lines.iter() {
writer.write_bed_line(data).unwrap();
}
}
{
let bed = Bed::new(path.to_str().unwrap(), false);
for (line, expected) in bed
.to_iter()
.zip(get_expected_bed_data_lines(&data_lines).iter())
{
assert_eq!(&line, expected);
}
}
path.close().unwrap();
}
#[test]
fn test_write_bedgraph() {
let data_lines = vec![
BedGraphDataLine::<f32> {
chrom: "chr1".into(),
start: 3,
end_exclusive: 10,
value: 5.,
},
BedGraphDataLine {
chrom: "chr1".into(),
start: 0,
end_exclusive: 23,
value: 6.,
},
BedGraphDataLine {
chrom: "chr3".into(),
start: 100,
end_exclusive: 115,
value: 11.,
},
BedGraphDataLine {
chrom: "chr1".into(),
start: 100,
end_exclusive: 150,
value: 18.,
},
];
let file = NamedTempFile::new().unwrap();
let path = file.into_temp_path();
{
let mut writer = BedWriter::new(path.to_str().unwrap()).unwrap();
for data in data_lines.iter() {
writer.write_bedgraph_line(data).unwrap();
}
}
{
let bedgraph = BedGraph::new(path.to_str().unwrap(), false);
for (expected, line) in data_lines
.iter()
.zip(bedgraph.to_iter(): BedGraphDataLineIter<f32>)
{
assert_eq!(expected, &line);
}
}
}
fn get_expected_bed_data_lines<D: Copy + Num>(
original_data_lines: &[BedDataLine<D>],
) -> Vec<BedDataLine<D>> {
original_data_lines
.iter()
.enumerate()
.map(|(i, l)| BedDataLine {
chrom: l.chrom.clone(),
start: l.start,
end: l.end,
name: Some(
l.name.clone().unwrap_or_else(|| format!("id_{}", i)),
),
score: Some(l.score.unwrap_or_else(D::zero)),
strand: l.strand,
})
.collect()
}
}
|
mod with_small_integer_time;
use proptest::strategy::Just;
use proptest::{prop_assert, prop_assert_eq};
use liblumen_alloc::erts::term::prelude::*;
use liblumen_alloc::erts::time::Milliseconds;
use crate::erlang;
use crate::erlang::start_timer_3::result;
use crate::test;
use crate::test::strategy::milliseconds;
use crate::test::{
freeze_at_timeout, freeze_timeout, has_message, registered_name, strategy, timeout_message,
};
// BigInt is not tested because it would take too long and would always count as `long_term` for the
// super shot soon and later wheel sizes used for `cfg(test)`
#[test]
fn without_non_negative_integer_time_error_badarg() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
strategy::term::is_not_non_negative_integer(arc_process.clone()),
strategy::term(arc_process.clone()),
)
},
|(arc_process, time, message)| {
let destination = arc_process.pid_term();
prop_assert_badarg!(
result(arc_process.clone(), time, destination, message),
format!("time ({}) is not a non-negative integer", time)
);
Ok(())
},
);
}
|
use super::Value;
use crate::{BitVec, Set};
use serde::{Deserialize, Serialize};
use std::{
convert::TryInto,
fmt::{self, Display},
slice::Iter as SliceIter,
};
// `u8` mostly for compatibility with dynasm
#[derive(
Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Debug, Default,
)]
pub(crate) struct Register(pub(crate) u8);
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Debug, Default)]
pub(crate) struct State {
pub(crate) registers: [Value; 16],
pub(crate) flags: [Value; 7],
// TODO: Implement Eq to ignore permutation of allocations.
pub(crate) allocations: Vec<Allocation>,
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Debug)]
pub(crate) enum Flag {
Carry = 0,
Parity = 1,
Adjust = 2,
Zero = 3,
Sign = 4,
Direction = 5,
Overflow = 6,
}
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Debug, Default)]
pub(crate) struct Allocation(pub(crate) Vec<Value>);
#[derive(Clone, Debug)]
pub(crate) struct StateIterator<'a> {
state: &'a State,
index: StateIteratorIndex<'a>,
}
#[derive(Clone, Debug)]
pub(crate) enum StateIteratorIndex<'a> {
Register(SliceIter<'a, Value>),
Flags(SliceIter<'a, Value>),
Allocations(SliceIter<'a, Allocation>),
Allocation(SliceIter<'a, Allocation>, SliceIter<'a, Value>),
Done,
}
impl Allocation {
pub(crate) fn len(&self) -> usize {
self.0.len()
}
pub(crate) fn iter(&self) -> <&Self as IntoIterator>::IntoIter {
self.into_iter()
}
}
impl Register {
pub(crate) fn as_u8(&self) -> u8 {
self.0
}
}
impl State {
pub fn is_valid(&self) -> bool {
use Value::*;
// Make sure all references are N:1 to allocations
let mut seen = BitVec::repeat(false, self.allocations.len());
for val in &self.registers {
if let Reference { index, .. } = val {
if let Some(mut bit) = seen.get_mut(*index) {
*bit = true;
} else {
return false;
}
}
}
// TODO: This does not correctly discount cyclical references.
for alloc in &self.allocations {
for val in alloc {
if let Reference { index, .. } = val {
if let Some(mut bit) = seen.get_mut(*index) {
*bit = true;
} else {
return false;
}
}
}
}
if seen.not_all() {
return false;
}
// Flags can only hold symbol, unspecified or boolean 0 / 1
for flag in &self.flags {
match flag {
Unspecified | Symbol(_) => {}
Literal(n) if *n <= 1 => {}
_ => return false,
}
}
// Otherwise it is valid
true
}
pub(crate) fn symbols(&self) -> Set<usize> {
self.into_iter()
.filter_map(|val| {
match val {
Value::Symbol(s) => Some(*s),
_ => None,
}
})
.collect()
}
pub(crate) fn literals(&self) -> Set<u64> {
self.into_iter()
.filter_map(|val| {
match val {
Value::Literal(l) => Some(*l),
_ => None,
}
})
.collect()
}
pub(crate) fn alloc_sizes(&self) -> Set<usize> {
self.allocations.iter().map(|a| a.0.len()).collect()
}
/// A goal is reachable if it contains a subset of our symbols.
pub(crate) fn reachable(&self, goal: &Self) -> bool {
debug_assert!(self.is_valid());
debug_assert!(goal.is_valid());
// Only Symbols matter, everything else can be constructed.
goal.symbols().is_subset(&self.symbols())
}
/// A goal is satisfied if all specified values are in place.
pub(crate) fn satisfies(&self, goal: &Self) -> bool {
fn valsat(reference_checks: &mut Set<(usize, usize)>, ours: &Value, goal: &Value) -> bool {
match goal {
Unspecified => true,
Reference {
index: goal_index,
offset: goal_offset,
} => {
match ours {
Reference {
index: our_index,
offset: our_offset,
} if our_offset == goal_offset => {
reference_checks.insert((*our_index, *goal_index));
true
}
_ => false,
}
}
val => ours == val,
}
}
use Value::*;
debug_assert!(self.is_valid());
debug_assert!(goal.is_valid());
// Values satisfy if `goal` is unspecified, they are identical or they are
// references with the same offset and the allocations satisfy.
let mut reference_checks: Set<(usize, usize)> = Set::default();
// Check registers and flags
let ours = self.registers.iter().chain(self.flags.iter());
let theirs = goal.registers.iter().chain(goal.flags.iter());
if !ours
.zip(theirs)
.all(|(a, b)| valsat(&mut reference_checks, a, b))
{
return false;
}
// Check correspondences between allocations, taking care of recursions
let mut checked = Set::default();
let mut done = reference_checks.is_empty();
while !done {
// Swap `reference_checks` for an empty one.
let mut to_check = Set::default();
std::mem::swap(&mut reference_checks, &mut to_check);
// Check previous values of `reference_check`.
for (our_index, their_index) in to_check {
let ours = &self.allocations[our_index];
let theirs = &goal.allocations[their_index];
if ours.len() != theirs.len()
|| !ours
.iter()
.zip(theirs.iter())
.all(|(a, b)| valsat(&mut reference_checks, a, b))
{
return false;
}
checked.insert((our_index, their_index));
}
// Remove already checked relationships
reference_checks = reference_checks
.difference(&checked)
.map(|(a, b)| (*a, *b))
.collect();
done = reference_checks.is_empty();
}
return true;
}
}
impl State {
pub(crate) fn get_register(&self, reg: Register) -> Value {
// `Register` can only contain valid indices
self.registers[reg.as_u8() as usize]
}
pub(crate) fn get_flag(&self, flag: Flag) -> Value {
self.flags[flag as usize]
}
pub(crate) fn get_reference(&self, reg: Register, offset: isize) -> Option<Value> {
match self.get_register(reg) {
Value::Reference {
index,
offset: roffset,
} => {
let alloc = self.allocations.get(index)?;
let offset: usize = (offset + roffset).try_into().ok()?;
alloc.0.get(offset).map(|a| *a)
}
_ => None,
}
}
pub(crate) fn get_mut_reference(&mut self, reg: Register, offset: isize) -> Option<&mut Value> {
match self.get_register(reg) {
Value::Reference {
index,
offset: roffset,
} => {
let alloc = self.allocations.get_mut(index)?;
let offset: usize = (offset + roffset).try_into().ok()?;
alloc.0.get_mut(offset)
}
_ => None,
}
}
}
impl Display for State {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for i in 0..=7 {
write!(f, " r{:<2} = {:18}", i, format!("{}", self.registers[i]))?;
writeln!(
f,
" r{:<2} = {:<18}",
i + 8,
format!("{}", self.registers[i + 8])
)?;
}
writeln!(
f,
" CF = {:4} PF = {:4} AF = {:4} ZF = {:4}",
format!("{}", self.flags[0]),
format!("{}", self.flags[1]),
format!("{}", self.flags[2]),
format!("{}", self.flags[3]),
)?;
writeln!(
f,
" SF = {:4} DF = {:4} OF = {:4}",
format!("{}", self.flags[4]),
format!("{}", self.flags[5]),
format!("{}", self.flags[6]),
)?;
for (i, alloc) in self.allocations.iter().enumerate() {
writeln!(f, " {}: {:18}", i, format!("{}", alloc.0[0]));
for value in alloc.iter().skip(1) {
writeln!(f, " {:18}", format!("{}", value));
}
}
// TODO: Flags + memory
Ok(())
}
}
impl<'a> IntoIterator for &'a Allocation {
type IntoIter = SliceIter<'a, Value>;
type Item = &'a Value;
fn into_iter(self) -> Self::IntoIter {
self.0.iter()
}
}
impl<'a> IntoIterator for &'a State {
type IntoIter = StateIterator<'a>;
type Item = &'a Value;
fn into_iter(self) -> Self::IntoIter {
StateIterator {
state: self,
index: StateIteratorIndex::Register(self.registers.iter()),
}
}
}
impl<'a> Iterator for StateIterator<'a> {
type Item = &'a Value;
fn next(&mut self) -> Option<Self::Item> {
use StateIteratorIndex::*;
match &mut self.index {
Register(iter) => {
iter.next().or_else(|| {
self.index = Flags(self.state.flags.iter());
self.next()
})
}
Flags(iter) => {
iter.next().or_else(|| {
self.index = Allocations(self.state.allocations.iter());
self.next()
})
}
Allocations(iter) => {
if let Some(alloc) = iter.next() {
self.index = Allocation(iter.clone(), alloc.into_iter());
self.next()
} else {
self.index = Done;
self.next()
}
}
Allocation(_, iter) => {
iter.next().or_else(|| {
// Satisfy borrow checker
if let Allocation(outer, _) = &self.index {
self.index = Allocations(outer.clone());
self.next()
} else {
panic!("Impossible state");
}
})
}
Done => None,
}
}
}
|
use proc_macro2::*;
use syn;
use meta::*;
use util::*;
pub fn derive(mut item: syn::DeriveInput) -> Result<TokenStream, Diagnostic> {
let flags =
MetaItem::with_name(&item.attrs, "diesel").unwrap_or_else(|| MetaItem::empty("diesel"));
let struct_ty = ty_for_foreign_derive(&item, &flags)?;
{
let where_clause = item
.generics
.where_clause
.get_or_insert(parse_quote!(where));
where_clause
.predicates
.push(parse_quote!(__DB: diesel::backend::Backend));
where_clause
.predicates
.push(parse_quote!(__ST: diesel::sql_types::SingleValue));
where_clause
.predicates
.push(parse_quote!(Self: FromSql<__ST, __DB>));
}
let (_, _, where_clause) = item.generics.split_for_impl();
let lifetimes = item.generics.lifetimes().collect::<Vec<_>>();
let ty_params = item.generics.type_params().collect::<Vec<_>>();
let const_params = item.generics.const_params().collect::<Vec<_>>();
Ok(wrap_in_dummy_mod(quote! {
use diesel::deserialize::{self, FromSql, Queryable};
// Need to put __ST and __DB after lifetimes but before const params
impl<#(#lifetimes,)* __ST, __DB, #(#ty_params,)* #(#const_params,)*> Queryable<__ST, __DB> for #struct_ty
#where_clause
{
type Row = Self;
fn build(row: Self::Row) -> deserialize::Result<Self> {
Ok(row)
}
}
}))
}
|
use crate::{consts, get_last_digit, Sudoku};
#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::vec::Vec;
#[cfg(all(feature = "smallvec", feature = "alloc"))]
type SudokuBackTrackingVec = smallvec::SmallVec<[Sudoku; 10]>;
#[cfg(all(not(feature = "smallvec"), feature = "alloc"))]
type SudokuBackTrackingVec = Vec<Sudoku>;
pub trait TechniqueRecording: Default {
fn record_step(&mut self, _: &Sudoku) {}
fn record_apply_number(&mut self, _: usize, _: &Sudoku) {}
fn record_scan(&mut self, _: &Sudoku) {}
fn record_hidden_single(&mut self, _: usize, _: &Sudoku) {}
type Output;
fn get_recording(&self) -> Self::Output;
}
pub struct SolutionIterator<T: TechniqueRecording> {
#[cfg(feature = "alloc")]
routes: SudokuBackTrackingVec,
recording: T,
}
impl<T> SolutionIterator<T>
where
T: TechniqueRecording,
{
pub fn new(mut sudoku: Sudoku) -> Self {
let mut temp = sudoku.solved_squares;
let mut valid = true;
while temp != 0 {
let square = get_last_digit!(temp, usize);
if sudoku.cells[square].is_power_of_two() {
sudoku.apply_number(square);
} else {
valid = false;
break;
}
}
#[cfg(feature = "alloc")]
let mut routes = SudokuBackTrackingVec::with_capacity(10);
#[cfg(feature = "alloc")]
if valid && sudoku.scan() {
routes.push(sudoku);
}
Self {
#[cfg(feature = "alloc")]
routes,
recording: T::default(),
}
}
pub fn get_recording(&self) -> T::Output {
self.recording.get_recording()
}
}
impl<T> Iterator for SolutionIterator<T>
where
T: TechniqueRecording,
{
type Item = Sudoku;
fn next(&mut self) -> Option<Self::Item> {
#[cfg(feature = "alloc")]
'outer: while let Some(mut state) = self.routes.pop() {
self.recording.record_step(&state);
if state.solved_squares.count_ones() == 81 {
return Some(state);
}
let mut min: (usize, u32) = (0, u32::MAX);
let mut temp = !state.solved_squares;
loop {
let square = get_last_digit!(temp, usize);
if square >= 81 {
break;
}
if state.cells[square] == 0 {
continue 'outer;
}
if state.cells[square].is_power_of_two()
|| match state.hidden_singles(square).ok() {
Some(result) => {
if result {
self.recording.record_hidden_single(square, &state);
};
result
}
None => continue 'outer,
}
{
self.recording.record_apply_number(square, &state);
if state.solved_squares.count_ones() == 80 {
state.solved_squares |= 1 << square;
return Some(state);
}
state.apply_number(square);
} else {
let possible_values = state.cells[square].count_ones();
if possible_values < min.1 {
min = (square, possible_values);
}
}
}
debug_assert!(min.1 <= 9);
if state.solved_squares.count_ones() >= consts::SCANNING_CUTOFF || {
self.recording.record_scan(&state);
state.scan()
} {
let mut value = state.cells[min.0];
while value != 0 {
let i = get_last_digit!(value, u16);
let mut new = state;
new.cells[min.0] = 1 << i;
self.recording.record_apply_number(min.0, &state);
new.apply_number(min.0);
self.routes.push(new);
}
}
}
None
}
}
#[derive(Default)]
pub struct NoRecording {}
impl TechniqueRecording for NoRecording {
type Output = ();
fn get_recording(&self) {}
}
pub type QuickSolutionIterator = SolutionIterator<NoRecording>;
|
mod bst;
use bst::*;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
fn main() {
let mut bst = BST::new();
let file = File::open("./src/res/morse.txt").expect("file not found");
let input = File::open("./src/res/message.txt").expect("file not found");
for file_line in BufReader::new(file).lines() {
let line = file_line.unwrap();
//ignore empty lines
if line != "" {
let data: Vec<&str> = line.split(" ").collect();
let temp: Vec<_> = data[0].to_string().chars().collect();
bst.insert(Pair::new(temp[0], data[1].to_string()));
//println!("{:?}", data);
}
}
//bst.inorder();
for file_line in BufReader::new(input).lines() {
let line = file_line.unwrap().to_uppercase();
let str_vec: Vec<_> = line.chars().collect();
for letter in str_vec {
if letter != ' ' {
let morse = bst.search(letter);
//println!("{}{}", morse, if letter == ' ' { " " } else { " " });
print!("{} ", morse);
}
else {
print!(" ");
}
}
println!("");
}
}
|
use crate::debug;
use crate::token::*;
use crate::source::Source;
use std::rc::Rc;
use anyhow::{anyhow, Result};
macro_rules! trace {
($self:ident, $msg: literal, $expression: expr) => {
debug!("start : {} : {:?}", $msg, $self.iter.peek());
let res = $expression;
debug!("end : {} : {:?} -> {:?}", $msg, $self.iter.peek(), res);
return res;
};
}
pub struct Tokenizer<'a> {
source: Rc<Source>, // reference to source file
iter: std::iter::Peekable<std::str::CharIndices<'a>>,
line: usize, // current line number
pos: usize, // current byte position in line
bytes: usize, // current byte postion in whole source file
}
impl Tokenizer<'_> {
pub fn new<'a>(source: Rc<Source>, content: &'a str) -> Tokenizer<'a> {
Tokenizer {
source: source.clone(),
iter: content.char_indices().peekable(),
line: 1,
pos: 0,
bytes: 0,
}
}
fn next(&mut self) -> Option<(usize, char)> {
if let Some((b, c)) = self.iter.next() {
match c {
'\n' => {
self.line += 1;
self.pos = 0;
}
_ => self.pos += 1,
}
self.bytes = b;
Some((b, c))
} else {
None
}
}
fn ensure<F>(&mut self, f: F)
where
F: FnOnce(char) -> bool,
{
self.consume_if(f).unwrap();
}
fn consume_if<F>(&mut self, f: F) -> Option<(char, Location)>
where
F: FnOnce(char) -> bool,
{
let current = self.iter.peek();
if current.is_none() {
return None;
}
let c = current.unwrap().1;
if !f(c) {
return None;
}
let loc = self.current_location();
let c = self.next().unwrap().1;
Some((c, loc))
}
fn consume_while<F>(&mut self, mut f: F) -> Option<(String, Location)>
where
F: FnMut(char, bool) -> bool,
{
let loc = self.current_location();
let mut s = String::new();
let mut escaped = false;
while let Some((_pos, c)) = self.iter.peek() {
if !f(*c, escaped) {
break;
}
let c = self.next().unwrap().1;
if c == '\\' {
escaped = true;
continue;
}
escaped = false;
s.push(c);
}
if s.is_empty() {
return None;
}
Some((s, loc))
}
fn consume_whitespaces(&mut self) -> TokenizeResult {
trace!(
self,
"consume_whitespaces",
self.consume_while(|c, _| c.is_ascii_whitespace())
.map(|t| Ok(Token::Whilespace(t.1)))
);
}
fn consume_comment(&mut self) -> TokenizeResult {
trace!(
self,
"consume_comment",
self.consume_if(|c| c == '/').and_then(|(_, loc)| {
match self.iter.peek() {
// "//" comment, read until new line
Some((_, '/')) => self.consume_single_line_comment(loc),
// "/* .. */" comment, read until "*/"
Some((_, '*')) => self.consume_multi_line_comment(loc),
// signle "/" token
Some((_, _)) => Some(Ok(Token::Symbol('/', loc))),
None => None,
}
})
);
}
fn consume_single_line_comment(&mut self, loc: Location) -> TokenizeResult {
let mut comments = self
.consume_while(|c, _| c != '\n')
.map(|t| t.0)
.unwrap_or("".to_string());
comments.insert(0, '/');
self.ensure(|c| c == '\n');
comments.push('\n');
Some(Ok(Token::Comment(comments, loc)))
}
fn consume_multi_line_comment(&mut self, loc: Location) -> TokenizeResult {
// discard current char ('*'), or panic if it isn't.
self.ensure(|c| c == '*');
let mut comments = String::from("/");
// read until "*/"
loop {
let s = self
.consume_while(|c, _| c != '*')
.map(|t| t.0)
.unwrap_or("".to_string());
comments.push_str(&s);
if let Some(_) = self.consume_if(|c| c == '*') {
comments.push('*');
}
match self.iter.peek() {
Some((_, '/')) => break,
Some((_, _)) => continue,
None => break,
}
}
// discard current char ('/'), or panic if it isn't.
self.consume_if(|c| c == '/')
.and_then(|_| {
comments.push('/');
Some(Ok(Token::Comment(comments, loc)))
})
.or(Some(Err(anyhow!("Tokenizer::string : unexpected EOF"))))
}
fn is_empty(&mut self) -> bool {
self.iter.peek().is_none()
}
fn next_token(&mut self) -> TokenizeResult {
// discard whiltespaces and comments
loop {
match self
.consume_whitespaces()
.or_else(|| self.consume_comment())
{
Some(Ok(Token::Whilespace(_))) => continue, // whilespace
Some(Ok(Token::Comment(_, _))) => continue, // comment
Some(res) => return Some(res), // found token (maybe '/')
None => break,
}
}
// parse token
self.symbol()
.or_else(|| self.string())
.or_else(|| self.keyword_or_identifier())
.or_else(|| self.integer())
}
fn current_location(&self) -> Location {
Location {
source: self.source.clone(),
line: self.line,
pos: self.pos,
bytes: self.bytes,
}
}
fn symbol(&mut self) -> TokenizeResult {
trace!(
self,
"symbol",
self.consume_if(is_symbol_char)
.map(|(c, loc)| Ok(Token::Symbol(c, loc)))
);
}
fn string(&mut self) -> TokenizeResult {
trace!(
self,
"string",
self.consume_if(|c| c == '"').and_then(|(_, loc)| {
let s = self
.consume_while(|c, escaped| escaped || (c != '"' && c != '\n'))
.map(|t| t.0)
.unwrap_or("".to_string());
self.next()
.map(|(_, c)| match c {
'"' => Ok(Token::Str(s, loc)),
c => Err(anyhow!("Tokenizer::string : unexpected char '{}'", c)),
})
.or(Some(Err(anyhow!("Tokenizer::string : unexpected EOF"))))
})
);
}
fn keyword_or_identifier(&mut self) -> TokenizeResult {
trace!(
self,
"keyword_or_identifier",
self.consume_if(|c| c.is_ascii_alphabetic() || c == '_')
.map(|(c, loc)| {
let mut s = self
.consume_while(|c, _| c.is_ascii_alphanumeric() || c == '_')
.map(|t| t.0)
.unwrap_or("".to_string());
s.insert(0, c);
let token = match keyword(&s) {
Some(kwd) => Token::Keyword(kwd, loc),
None => Token::Identifier(s, loc),
};
Ok(token)
})
);
}
fn integer(&mut self) -> TokenizeResult {
trace!(
self,
"integer",
self.consume_while(|c, _| c.is_ascii_alphanumeric() || c == '_')
.map(|(s, loc)| {
s.parse::<u16>().map_err(|err| anyhow!(err)).and_then(|n| {
if n <= 32767 {
Ok(Token::Integer(n, loc))
} else {
Err(anyhow!(
"number must be grater equal than 0 and less equal than 32767 : {}",
n
))
}
})
})
);
}
}
impl Iterator for Tokenizer<'_> {
type Item = Result<Token>;
fn next(&mut self) -> TokenizeResult {
if self.is_empty() {
return None;
}
let res = self.next_token();
debug!(" token -> {:?}", res);
res
}
}
|
pub mod rand;
use math::big::Int;
pub fn is_big_int_normalized(x: &Int) -> bool {
match x.bits().next_back() {
None => x.sign() == 0,
Some(v) => v != 0,
}
}
|
pub use hex;
pub use downcast_rs;
pub use slice_cast;
|
#[doc = r"Value read from the register"]
pub struct R {
bits: u8,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::TXCSRH4 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
self.register.set(f(&R { bits }, &mut W { bits }).bits);
}
#[doc = r"Reads the contents of the register"]
#[inline(always)]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r"Writes to the register"]
#[inline(always)]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
self.register.set(
f(&mut W {
bits: Self::reset_value(),
})
.bits,
);
}
#[doc = r"Reset value of the register"]
#[inline(always)]
pub const fn reset_value() -> u8 {
0
}
#[doc = r"Writes the reset value to the register"]
#[inline(always)]
pub fn reset(&self) {
self.register.set(Self::reset_value())
}
}
#[doc = r"Value of the field"]
pub struct USB_TXCSRH4_DTR {
bits: bool,
}
impl USB_TXCSRH4_DTR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _USB_TXCSRH4_DTW<'a> {
w: &'a mut W,
}
impl<'a> _USB_TXCSRH4_DTW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(1 << 0);
self.w.bits |= ((value as u8) & 1) << 0;
self.w
}
}
#[doc = r"Value of the field"]
pub struct USB_TXCSRH4_DTWER {
bits: bool,
}
impl USB_TXCSRH4_DTWER {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _USB_TXCSRH4_DTWEW<'a> {
w: &'a mut W,
}
impl<'a> _USB_TXCSRH4_DTWEW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(1 << 1);
self.w.bits |= ((value as u8) & 1) << 1;
self.w
}
}
#[doc = r"Value of the field"]
pub struct USB_TXCSRH4_DMAMODR {
bits: bool,
}
impl USB_TXCSRH4_DMAMODR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _USB_TXCSRH4_DMAMODW<'a> {
w: &'a mut W,
}
impl<'a> _USB_TXCSRH4_DMAMODW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(1 << 2);
self.w.bits |= ((value as u8) & 1) << 2;
self.w
}
}
#[doc = r"Value of the field"]
pub struct USB_TXCSRH4_FDTR {
bits: bool,
}
impl USB_TXCSRH4_FDTR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _USB_TXCSRH4_FDTW<'a> {
w: &'a mut W,
}
impl<'a> _USB_TXCSRH4_FDTW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(1 << 3);
self.w.bits |= ((value as u8) & 1) << 3;
self.w
}
}
#[doc = r"Value of the field"]
pub struct USB_TXCSRH4_DMAENR {
bits: bool,
}
impl USB_TXCSRH4_DMAENR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _USB_TXCSRH4_DMAENW<'a> {
w: &'a mut W,
}
impl<'a> _USB_TXCSRH4_DMAENW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(1 << 4);
self.w.bits |= ((value as u8) & 1) << 4;
self.w
}
}
#[doc = r"Value of the field"]
pub struct USB_TXCSRH4_MODER {
bits: bool,
}
impl USB_TXCSRH4_MODER {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _USB_TXCSRH4_MODEW<'a> {
w: &'a mut W,
}
impl<'a> _USB_TXCSRH4_MODEW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(1 << 5);
self.w.bits |= ((value as u8) & 1) << 5;
self.w
}
}
#[doc = r"Value of the field"]
pub struct USB_TXCSRH4_ISOR {
bits: bool,
}
impl USB_TXCSRH4_ISOR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _USB_TXCSRH4_ISOW<'a> {
w: &'a mut W,
}
impl<'a> _USB_TXCSRH4_ISOW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(1 << 6);
self.w.bits |= ((value as u8) & 1) << 6;
self.w
}
}
#[doc = r"Value of the field"]
pub struct USB_TXCSRH4_AUTOSETR {
bits: bool,
}
impl USB_TXCSRH4_AUTOSETR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _USB_TXCSRH4_AUTOSETW<'a> {
w: &'a mut W,
}
impl<'a> _USB_TXCSRH4_AUTOSETW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(1 << 7);
self.w.bits |= ((value as u8) & 1) << 7;
self.w
}
}
impl R {
#[doc = r"Value of the register as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
#[doc = "Bit 0 - Data Toggle"]
#[inline(always)]
pub fn usb_txcsrh4_dt(&self) -> USB_TXCSRH4_DTR {
let bits = ((self.bits >> 0) & 1) != 0;
USB_TXCSRH4_DTR { bits }
}
#[doc = "Bit 1 - Data Toggle Write Enable"]
#[inline(always)]
pub fn usb_txcsrh4_dtwe(&self) -> USB_TXCSRH4_DTWER {
let bits = ((self.bits >> 1) & 1) != 0;
USB_TXCSRH4_DTWER { bits }
}
#[doc = "Bit 2 - DMA Request Mode"]
#[inline(always)]
pub fn usb_txcsrh4_dmamod(&self) -> USB_TXCSRH4_DMAMODR {
let bits = ((self.bits >> 2) & 1) != 0;
USB_TXCSRH4_DMAMODR { bits }
}
#[doc = "Bit 3 - Force Data Toggle"]
#[inline(always)]
pub fn usb_txcsrh4_fdt(&self) -> USB_TXCSRH4_FDTR {
let bits = ((self.bits >> 3) & 1) != 0;
USB_TXCSRH4_FDTR { bits }
}
#[doc = "Bit 4 - DMA Request Enable"]
#[inline(always)]
pub fn usb_txcsrh4_dmaen(&self) -> USB_TXCSRH4_DMAENR {
let bits = ((self.bits >> 4) & 1) != 0;
USB_TXCSRH4_DMAENR { bits }
}
#[doc = "Bit 5 - Mode"]
#[inline(always)]
pub fn usb_txcsrh4_mode(&self) -> USB_TXCSRH4_MODER {
let bits = ((self.bits >> 5) & 1) != 0;
USB_TXCSRH4_MODER { bits }
}
#[doc = "Bit 6 - Isochronous Transfers"]
#[inline(always)]
pub fn usb_txcsrh4_iso(&self) -> USB_TXCSRH4_ISOR {
let bits = ((self.bits >> 6) & 1) != 0;
USB_TXCSRH4_ISOR { bits }
}
#[doc = "Bit 7 - Auto Set"]
#[inline(always)]
pub fn usb_txcsrh4_autoset(&self) -> USB_TXCSRH4_AUTOSETR {
let bits = ((self.bits >> 7) & 1) != 0;
USB_TXCSRH4_AUTOSETR { bits }
}
}
impl W {
#[doc = r"Writes raw bits to the register"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 0 - Data Toggle"]
#[inline(always)]
pub fn usb_txcsrh4_dt(&mut self) -> _USB_TXCSRH4_DTW {
_USB_TXCSRH4_DTW { w: self }
}
#[doc = "Bit 1 - Data Toggle Write Enable"]
#[inline(always)]
pub fn usb_txcsrh4_dtwe(&mut self) -> _USB_TXCSRH4_DTWEW {
_USB_TXCSRH4_DTWEW { w: self }
}
#[doc = "Bit 2 - DMA Request Mode"]
#[inline(always)]
pub fn usb_txcsrh4_dmamod(&mut self) -> _USB_TXCSRH4_DMAMODW {
_USB_TXCSRH4_DMAMODW { w: self }
}
#[doc = "Bit 3 - Force Data Toggle"]
#[inline(always)]
pub fn usb_txcsrh4_fdt(&mut self) -> _USB_TXCSRH4_FDTW {
_USB_TXCSRH4_FDTW { w: self }
}
#[doc = "Bit 4 - DMA Request Enable"]
#[inline(always)]
pub fn usb_txcsrh4_dmaen(&mut self) -> _USB_TXCSRH4_DMAENW {
_USB_TXCSRH4_DMAENW { w: self }
}
#[doc = "Bit 5 - Mode"]
#[inline(always)]
pub fn usb_txcsrh4_mode(&mut self) -> _USB_TXCSRH4_MODEW {
_USB_TXCSRH4_MODEW { w: self }
}
#[doc = "Bit 6 - Isochronous Transfers"]
#[inline(always)]
pub fn usb_txcsrh4_iso(&mut self) -> _USB_TXCSRH4_ISOW {
_USB_TXCSRH4_ISOW { w: self }
}
#[doc = "Bit 7 - Auto Set"]
#[inline(always)]
pub fn usb_txcsrh4_autoset(&mut self) -> _USB_TXCSRH4_AUTOSETW {
_USB_TXCSRH4_AUTOSETW { w: self }
}
}
|
#[doc = "Reader of register CR"]
pub type R = crate::R<u32, super::CR>;
#[doc = "Writer for register CR"]
pub type W = crate::W<u32, super::CR>;
#[doc = "Register CR `reset()`'s with value 0"]
impl crate::ResetValue for super::CR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `TRGOEN`"]
pub type TRGOEN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TRGOEN`"]
pub struct TRGOEN_W<'a> {
w: &'a mut W,
}
impl<'a> TRGOEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 28)) | (((value as u32) & 0x01) << 28);
self.w
}
}
#[doc = "Reader of field `D3DBGCKEN`"]
pub type D3DBGCKEN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `D3DBGCKEN`"]
pub struct D3DBGCKEN_W<'a> {
w: &'a mut W,
}
impl<'a> D3DBGCKEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 22)) | (((value as u32) & 0x01) << 22);
self.w
}
}
#[doc = "Reader of field `D1DBGCKEN`"]
pub type D1DBGCKEN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `D1DBGCKEN`"]
pub struct D1DBGCKEN_W<'a> {
w: &'a mut W,
}
impl<'a> D1DBGCKEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 21)) | (((value as u32) & 0x01) << 21);
self.w
}
}
#[doc = "Reader of field `TRACECLKEN`"]
pub type TRACECLKEN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TRACECLKEN`"]
pub struct TRACECLKEN_W<'a> {
w: &'a mut W,
}
impl<'a> TRACECLKEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20);
self.w
}
}
#[doc = "Reader of field `DBGSTBY_D1`"]
pub type DBGSTBY_D1_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DBGSTBY_D1`"]
pub struct DBGSTBY_D1_W<'a> {
w: &'a mut W,
}
impl<'a> DBGSTBY_D1_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
self.w
}
}
#[doc = "Reader of field `DBGSTOP_D1`"]
pub type DBGSTOP_D1_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DBGSTOP_D1`"]
pub struct DBGSTOP_D1_W<'a> {
w: &'a mut W,
}
impl<'a> DBGSTOP_D1_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
self.w
}
}
#[doc = "Reader of field `DBGSLEEP_D1`"]
pub type DBGSLEEP_D1_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DBGSLEEP_D1`"]
pub struct DBGSLEEP_D1_W<'a> {
w: &'a mut W,
}
impl<'a> DBGSLEEP_D1_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
self.w
}
}
#[doc = "Reader of field `DBGSTBY_D2`"]
pub type DBGSTBY_D2_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DBGSTBY_D2`"]
pub struct DBGSTBY_D2_W<'a> {
w: &'a mut W,
}
impl<'a> DBGSTBY_D2_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
self.w
}
}
#[doc = "Reader of field `DBGSTOP_D2`"]
pub type DBGSTOP_D2_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DBGSTOP_D2`"]
pub struct DBGSTOP_D2_W<'a> {
w: &'a mut W,
}
impl<'a> DBGSTOP_D2_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
self.w
}
}
#[doc = "Reader of field `DBGSLEEP_D2`"]
pub type DBGSLEEP_D2_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DBGSLEEP_D2`"]
pub struct DBGSLEEP_D2_W<'a> {
w: &'a mut W,
}
impl<'a> DBGSLEEP_D2_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
self.w
}
}
impl R {
#[doc = "Bit 28 - External trigger output enable"]
#[inline(always)]
pub fn trgoen(&self) -> TRGOEN_R {
TRGOEN_R::new(((self.bits >> 28) & 0x01) != 0)
}
#[doc = "Bit 22 - D3 debug clock enable enable"]
#[inline(always)]
pub fn d3dbgcken(&self) -> D3DBGCKEN_R {
D3DBGCKEN_R::new(((self.bits >> 22) & 0x01) != 0)
}
#[doc = "Bit 21 - D1 debug clock enable enable"]
#[inline(always)]
pub fn d1dbgcken(&self) -> D1DBGCKEN_R {
D1DBGCKEN_R::new(((self.bits >> 21) & 0x01) != 0)
}
#[doc = "Bit 20 - Trace clock enable enable"]
#[inline(always)]
pub fn traceclken(&self) -> TRACECLKEN_R {
TRACECLKEN_R::new(((self.bits >> 20) & 0x01) != 0)
}
#[doc = "Bit 2 - Allow debug in D1 Standby mode"]
#[inline(always)]
pub fn dbgstby_d1(&self) -> DBGSTBY_D1_R {
DBGSTBY_D1_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - Allow debug in D1 Stop mode"]
#[inline(always)]
pub fn dbgstop_d1(&self) -> DBGSTOP_D1_R {
DBGSTOP_D1_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - Allow debug in D1 Sleep mode"]
#[inline(always)]
pub fn dbgsleep_d1(&self) -> DBGSLEEP_D1_R {
DBGSLEEP_D1_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 5 - Allow debug in D2 Standby mode"]
#[inline(always)]
pub fn dbgstby_d2(&self) -> DBGSTBY_D2_R {
DBGSTBY_D2_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 4 - Allow debug in D2 Stop mode"]
#[inline(always)]
pub fn dbgstop_d2(&self) -> DBGSTOP_D2_R {
DBGSTOP_D2_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 3 - Allow debug in D2 Sleep mode"]
#[inline(always)]
pub fn dbgsleep_d2(&self) -> DBGSLEEP_D2_R {
DBGSLEEP_D2_R::new(((self.bits >> 3) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 28 - External trigger output enable"]
#[inline(always)]
pub fn trgoen(&mut self) -> TRGOEN_W {
TRGOEN_W { w: self }
}
#[doc = "Bit 22 - D3 debug clock enable enable"]
#[inline(always)]
pub fn d3dbgcken(&mut self) -> D3DBGCKEN_W {
D3DBGCKEN_W { w: self }
}
#[doc = "Bit 21 - D1 debug clock enable enable"]
#[inline(always)]
pub fn d1dbgcken(&mut self) -> D1DBGCKEN_W {
D1DBGCKEN_W { w: self }
}
#[doc = "Bit 20 - Trace clock enable enable"]
#[inline(always)]
pub fn traceclken(&mut self) -> TRACECLKEN_W {
TRACECLKEN_W { w: self }
}
#[doc = "Bit 2 - Allow debug in D1 Standby mode"]
#[inline(always)]
pub fn dbgstby_d1(&mut self) -> DBGSTBY_D1_W {
DBGSTBY_D1_W { w: self }
}
#[doc = "Bit 1 - Allow debug in D1 Stop mode"]
#[inline(always)]
pub fn dbgstop_d1(&mut self) -> DBGSTOP_D1_W {
DBGSTOP_D1_W { w: self }
}
#[doc = "Bit 0 - Allow debug in D1 Sleep mode"]
#[inline(always)]
pub fn dbgsleep_d1(&mut self) -> DBGSLEEP_D1_W {
DBGSLEEP_D1_W { w: self }
}
#[doc = "Bit 5 - Allow debug in D2 Standby mode"]
#[inline(always)]
pub fn dbgstby_d2(&mut self) -> DBGSTBY_D2_W {
DBGSTBY_D2_W { w: self }
}
#[doc = "Bit 4 - Allow debug in D2 Stop mode"]
#[inline(always)]
pub fn dbgstop_d2(&mut self) -> DBGSTOP_D2_W {
DBGSTOP_D2_W { w: self }
}
#[doc = "Bit 3 - Allow debug in D2 Sleep mode"]
#[inline(always)]
pub fn dbgsleep_d2(&mut self) -> DBGSLEEP_D2_W {
DBGSLEEP_D2_W { w: self }
}
}
|
use anyhow::{anyhow, Context, Result};
use image::RgbaImage;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use std::sync::atomic::{AtomicBool, Ordering};
use tobj::{Material, Model};
use crate::logger::logger;
use slog::debug;
static mut LOADER: Option<&dyn ResourceLoader> = None;
static INITIALIZED: AtomicBool = AtomicBool::new(false);
fn set_singleton(loader: &'static dyn ResourceLoader) {
set_singleton_inner(|| loader)
}
fn set_singleton_inner<F>(make_singleton: F)
where
F: FnOnce() -> &'static dyn ResourceLoader,
{
unsafe {
if !std::ptr::read(&INITIALIZED).into_inner() {
LOADER = Some(make_singleton());
INITIALIZED.store(true, Ordering::Relaxed);
debug!(logger(), "resource loader initialized.");
}
}
}
pub fn init_loader(root: PathBuf) -> Result<()> {
let loader = Box::new(DefaultLoader::new(root));
set_singleton(Box::leak(loader));
Ok(())
}
pub fn loader() -> Result<&'static dyn ResourceLoader> {
unsafe {
if !std::ptr::read(&INITIALIZED).into_inner() {
return Err(anyhow!("loader not intialized"));
}
Ok(LOADER.unwrap())
}
}
// Load resources
pub trait ResourceLoader {
fn load_text(&self, name: &str) -> Result<String>;
fn load_bytes(&self, name: &str) -> Result<Vec<u8>>;
// .obj can contain multiple models
fn load_obj(&self, name: &str) -> Result<(Vec<Model>, Vec<Material>)>;
fn load_rgba(&self, name: &str) -> Result<RgbaImage>;
}
// Load from a base directory
#[derive(Debug)]
pub struct DefaultLoader {
base_dir: PathBuf,
}
impl DefaultLoader {
pub fn new(root_dir: PathBuf) -> Self {
DefaultLoader { base_dir: root_dir }
}
}
impl ResourceLoader for DefaultLoader {
fn load_text(&self, name: &str) -> Result<String> {
let file_path = self.base_dir.join(name);
let mut contents = String::new();
File::open(&file_path)
.with_context(|| format!("Failed to open file {:?}", &file_path))?
.read_to_string(&mut contents)
.with_context(|| format!("Failed to read file {:?}", &file_path))?;
Ok(contents)
}
fn load_bytes(&self, name: &str) -> Result<Vec<u8>> {
let file_path = self.base_dir.join(name);
let mut contents = Vec::new();
File::open(&file_path)
.with_context(|| format!("Failed to open file {:?}", &file_path))?
.read_to_end(&mut contents)
.with_context(|| format!("Failed to read file {:?}", &file_path))?;
Ok(contents)
}
fn load_obj(&self, name: &str) -> Result<(Vec<Model>, Vec<Material>)> {
let file_path = self.base_dir.join(name);
let (objs, materials) = tobj::load_obj(&file_path, true)
.with_context(|| format!("Failed to load obj: {:?}", &file_path))?;
// let meshes = objs.into_iter().map(|obj| obj.mesh).collect();
Ok((objs, materials))
}
fn load_rgba(&self, name: &str) -> Result<RgbaImage> {
let file_path = self.base_dir.join(name);
let img = image::open(&file_path)
.with_context(|| format!("Failed to open file {:?}", &file_path))?;
Ok(img.to_rgba8())
}
}
|
#[path = "with_flush_option/with_monitor.rs"]
mod with_monitor;
test_stdout!(without_monitor_returns_true, "true\n");
|
pub mod buildaccelerationstructureflagsnv;
pub mod copyaccelerationstructuremodenv;
pub mod geometryflagsnv;
pub mod geometryinstanceflagsnv;
pub mod geometrytypenv;
pub mod raytracingshadergrouptypenv;
pub mod accelerationstructurememoryrequirementstypenv;
pub mod accelerationstructuretypenv;
pub mod prelude;
|
//! Tests auto-converted from "sass-spec/spec/libsass/features"
#[allow(unused)]
use super::rsass;
#[allow(unused)]
use rsass::precision;
// Ignoring "at-error", not expected to work yet.
// Ignoring "extend-selector-pseudoclass", not expected to work yet.
/// From "sass-spec/spec/libsass/features/global-variable-shadowing"
#[test]
fn global_variable_shadowing() {
assert_eq!(
rsass(
"foo {\n foo: feature-exists(\'global-variable-shadowing\');\n}\n"
)
.unwrap(),
"foo {\n foo: true;\n}\n"
);
}
/// From "sass-spec/spec/libsass/features/units-level-3"
#[test]
fn units_level_3() {
assert_eq!(
rsass("foo {\n foo: feature-exists(\'units-level-3\');\n}\n")
.unwrap(),
"foo {\n foo: true;\n}\n"
);
}
|
fn main() {
proconio::input!{n:u64};
println!("{}", n / 500 * 1000 + ((n % 500) / 5) * 5)
} |
use game_lib::{
bevy::prelude::*,
derive_more::{Display, From, Into},
serde::{Deserialize, Serialize},
};
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, Serialize, Deserialize, Reflect)]
#[serde(crate = "game_lib::serde")]
pub enum Tile {
Stone,
Dirt,
}
impl Tile {
pub fn index(self) -> TileSheetIndex {
match self {
Tile::Dirt => 0.into(),
Tile::Stone => 1.into(),
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, From, Into)]
pub struct TileSheetIndex(pub u16);
impl TileSheetIndex {
pub fn into_uv(self, row_width: u16, rows: u16) -> (f32, f32) {
let x = self.0 % row_width;
let y = self.0 / row_width;
(x as f32 / row_width as f32, y as f32 / rows as f32)
}
}
impl From<Tile> for TileSheetIndex {
fn from(tile: Tile) -> Self {
tile.index()
}
}
|
use crate::utils;
pub fn run(problem: &i32, input: &str) {
match problem {
1 => {
problem1(input);
}
2 => {
problem2(input);
}
_ => {
panic!("Unknown problem: {}", problem);
}
};
}
fn problem1(input: &str) {
let mut total = 0;
if let Ok(lines) = utils::read_lines(input) {
for line in lines {
if let Ok(s) = line {
let parts: Vec<&str> = s.split(" ").collect();
let opp = parts[0];
let you = parts[1];
let round = match opp {
// rock
"A" => match you {
"X" => 1 + 3, // rock
"Y" => 2 + 6, // paper
"Z" => 3 + 0, // scissor
_ => panic!("Unknown you value: {}", you),
},
// paper
"B" => match you {
"X" => 1 + 0, // rock
"Y" => 2 + 3, // paper
"Z" => 3 + 6, // scissor
_ => panic!("Unknown you value: {}", you),
},
// scissors
"C" => match you {
"X" => 1 + 6, // rock
"Y" => 2 + 0, // paper
"Z" => 3 + 3, // scissor
_ => panic!("Unknown you value: {}", you),
},
_ => panic!("Unknown opp value: {}", opp),
};
total += round;
}
}
}
println!("Total score: {}", total);
}
fn problem2(input: &str) {
let mut total = 0;
if let Ok(lines) = utils::read_lines(input) {
for line in lines {
if let Ok(s) = line {
let parts: Vec<&str> = s.split(" ").collect();
let opp = parts[0];
let result = parts[1];
let round = match opp {
// rock
"A" => match result {
"X" => 3 + 0, // lose
"Y" => 1 + 3, // draw
"Z" => 2 + 6, // win
_ => panic!("Unknown result value: {}", result),
},
// paper
"B" => match result {
"X" => 1 + 0, // lose
"Y" => 2 + 3, // draw
"Z" => 3 + 6, // win
_ => panic!("Unknown result value: {}", result),
},
// scissors
"C" => match result {
"X" => 2 + 0, // lose
"Y" => 3 + 3, // draw
"Z" => 1 + 6, // win
_ => panic!("Unknown result value: {}", result),
},
_ => panic!("Unknown opp value: {}", opp),
};
total += round;
}
}
}
println!("Total score: {}", total);
}
|
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(clippy::missing_safety_doc)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
mod ioctl;
pub use ioctl::*;
|
use anyhow::*;
use liblumen_alloc::erts::exception;
use liblumen_alloc::erts::term::prelude::*;
#[native_implemented::function(erlang:system_flag/2)]
pub fn result(flag: Term, _value: Term) -> exception::Result<Term> {
let flag_atom = term_try_into_atom!(flag)?;
match flag_atom.name() {
"backtrace_depth" => unimplemented!(),
"cpu_topology" => unimplemented!(),
"dirty_cpu_schedulers_online" => unimplemented!(),
"erts_alloc" => unimplemented!(),
"fullsweep_after" => unimplemented!(),
"microstate_accounting" => unimplemented!(),
"min_heap_size" => unimplemented!(),
"min_bin_vheap_size" => unimplemented!(),
"max_heap_size" => unimplemented!(),
"multi_scheduling" => unimplemented!(),
"scheduler_bind_type" => unimplemented!(),
"schedulers_online" => unimplemented!(),
"system_logger" => unimplemented!(),
"trace_control_word" => unimplemented!(),
"time_offset" => unimplemented!(),
_ => Err(anyhow!(
"flag ({}) is not supported (backtrace_depth, cpu_topology, \
dirty_cpu_schedulers_online, erts_alloc, fullsweep_after, microstate_accounting, \
min_heap_size, min_bin_vheap_size, max_heap_size, multi_scheduling, \
scheduler_bind_type, schedulers_online, system_logger, trace_control_word, \
time_offset)"
)
.into()),
}
}
|
use crate::io::Encode;
use crate::mssql::io::MssqlBufMutExt;
use crate::mssql::protocol::header::{AllHeaders, Header};
#[derive(Debug)]
pub(crate) struct SqlBatch<'a> {
pub(crate) transaction_descriptor: u64,
pub(crate) sql: &'a str,
}
impl Encode<'_> for SqlBatch<'_> {
fn encode_with(&self, buf: &mut Vec<u8>, _: ()) {
AllHeaders(&[Header::TransactionDescriptor {
outstanding_request_count: 1,
transaction_descriptor: self.transaction_descriptor,
}])
.encode(buf);
// SQLText
buf.put_utf16_str(self.sql);
}
}
|
use std::cmp::min;
use std::collections::hash_map::HashMap;
use crate::parser::ast_utils::*;
use crate::parser::tokens::*;
use crate::parser::ast_printer::print_ast_node;
use super::stored_value::StoredValue;
use super::constexpr::get_constant_value_from_node;
// AMD64 assembly codegen
// In the x86-64 System V calling convention macOS uses,
// args are passed in certain registers and then on the stack
static ARGUMENT_LOCATIONS: &[&str] = &[
"%rdi", "%rsi", "%rdx", "%rcx", "%r8", "%r9"
];
static MAX_ARGS: usize = ARGUMENT_LOCATIONS.len();
pub struct Codegen {
pub ast: Vec<ASTNode>,
pub generated: String,
// Used to generate unique assembly jump labels and aligner names
pub counter: usize,
// A stack of hashmaps of local var names to stack offsets
pub var_context: Vec<HashMap<String, StoredValue>>,
pub stack_offset: isize,
pub block_depth: usize,
// Indicates whether we're emitting inside code that will
// not necessarily execute (if, for, while, etc.) For example, we
// can detect whether a function is guaranteed to return or not.
pub conditional_code_depth: usize,
// Detects whether a function can end without returning
pub func_has_unconditional_return: bool
}
impl Codegen {
pub fn generate (&mut self) {
self.generated = String::from("");
// There is a global variable context that never ends.
// This cannot have stack vars in it and does not get cleaned up.
self.begin_var_scope();
for node in self.ast.clone() {
self.emit_for_node(&node)
}
}
fn emit_for_block (&mut self, block: &Vec<ASTNode>, is_function_body_scope: bool) {
// Function scopes are alloced beforehand to put arguments into.
if !is_function_body_scope { self.begin_var_scope(); }
for node in block {
if self.func_has_unconditional_return {
eprintln!("[warn] Dead code detected at:");
print_ast_node(node, 1);
eprintln!("[info] Skipping rest of function due to dead code elimination");
break;
}
self.emit_for_node(node)
}
self.end_runtime_var_scope(true);
self.end_compiletime_var_scope();
}
fn emit_for_node (&mut self, node: &ASTNode) {
match node {
ASTNode::IntegerLiteral(int) => {
self.emit(format!("mov ${}, %rax", int))
},
ASTNode::ReturnStatement(ret) => {
if self.conditional_code_depth == 0 {
self.func_has_unconditional_return = true;
}
self.emit_for_node(&ret);
self.end_runtime_var_scope(false);
self.emit_function_epilogue(false);
},
ASTNode::UnaryOperation(unar) => {
self.emit_for_unary_operation(unar)
},
ASTNode::BinaryOperation(bin) => {
self.emit_for_binary_operation(bin)
},
ASTNode::VariableDeclaration(var) => {
self.emit_for_variable_declaration(var)
},
ASTNode::Identifier(ident) => {
let stored = self.find_var(ident).clone();
self.emit_for_stored_value_access(&stored)
},
ASTNode::BlockStatement(stmts) => {
self.emit_for_block(stmts, false)
},
ASTNode::IfStatement(if_stmt) => {
self.emit_for_if_statement(if_stmt)
},
ASTNode::FunctionDefinition(func) => {
self.emit_for_function_definition(func)
},
ASTNode::FunctionCall(func_call) => {
self.emit_for_function_call(func_call)
},
ASTNode::WhileLoop(while_loop) => {
self.emit_for_while_loop(while_loop)
},
ASTNode::ForLoop(for_loop) => {
self.emit_for_for_loop(for_loop)
},
ASTNode::StringLiteral(st) => {
self.emit_for_string_literal(&st)
}
}
}
fn emit_for_string_literal (&mut self, st: &String) {
self.emit_str(".data");
let label = self.get_unique_label("string");
self.emit(format!("{}:", label));
self.emit(format!(".string \"{}\"", st));
self.emit_str(".text");
self.emit(format!("lea {}(%rip), %rax", label));
}
fn emit_for_function_call (&mut self, func_call: &ASTFunctionCall) {
// println!("Call to {}", func_call.name);
// First 6 args are put into registers
let reg_args = min(func_call.args.len(), MAX_ARGS);
for i in 0..reg_args {
let arg = &func_call.args[i];
let arg_loc = ARGUMENT_LOCATIONS[i];
self.emit_for_node(arg);
self.emit(format!("mov %rax, {}", arg_loc));
}
let arg_allocs = (MAX_ARGS..func_call.args.len()).len() as isize;
self.align_stack(arg_allocs * -8);
// Additional args are pushed on to the stack in reverse order
for i in (MAX_ARGS..func_call.args.len()).rev() {
let arg = &func_call.args[i];
self.emit_for_node(arg);
self.emit_str("push %rax");
}
self.emit(format!("call _{}", func_call.name));
}
fn emit_for_function_definition (&mut self, func: &ASTFunctionDefinition) {
// For now, we don't care about function definitions without a body.
// They would be important if we didn't know a func's return type, but this compiler
// doesn't deal with types atm
if let Some(body) = &func.body {
self.emit(format!(".globl _{}", func.name));
self.emit(format!("_{}:", func.name));
self.emit_function_prologue();
// Alloc arguments
self.begin_var_scope();
let reg_args = min(func.params.len(), MAX_ARGS);
for i in 0..reg_args {
let arg = &func.params[i];
let arg_loc = ARGUMENT_LOCATIONS[i];
self.emit_stack_alloc_from_location(&arg, arg_loc);
}
// Additional args are in the stack in reverse order
let mut offset: isize = 16;
for i in (MAX_ARGS..func.params.len()).rev() {
let arg = &func.params[i];
self.stack_alloc_from_arbitrary_offset(&arg, offset);
offset += 8;
}
self.emit_for_block(body, true);
// Dealloc args
// self.end_var_scope_without_dealloc();
if !self.func_has_unconditional_return {
// We couldn't guarantee that the function will return a value
self.emit_function_epilogue(true);
}
self.func_has_unconditional_return = false;
}
}
fn emit_for_if_statement (&mut self, if_stmt: &ASTIfStatement) {
self.conditional_code_depth += 1;
self.emit_for_node(&if_stmt.condition);
self.emit_str("cmp $0, %rax");
let skip_label = self.get_unique_label("if_skip");
let else_label = self.get_unique_label("else");
self.emit(format!("je {}", else_label));
self.emit_for_node(&if_stmt.body);
self.emit(format!("jmp {}", skip_label));
self.emit(format!("{}:", else_label));
if let Some(else_node) = &if_stmt.else_stmt {
self.emit_for_node(else_node);
}
self.emit(format!("{}:", skip_label));
self.conditional_code_depth -= 1;
}
fn emit_for_while_loop (&mut self, while_loop: &ASTWhileLoop) {
self.conditional_code_depth += 1;
let start_label = self.get_unique_label("while_start");
let end_label = self.get_unique_label("while_end");
self.emit(format!("{}:", start_label));
// Eval condition
self.emit_for_node(&while_loop.condition);
self.emit_str("cmp $0, %rax");
self.emit(format!("je {}", end_label));
// Run body
self.emit_for_node(&while_loop.body);
// Unconditionally jump to top
self.emit(format!("jmp {}", start_label));
self.emit(format!("{}:", end_label));
self.conditional_code_depth -= 1;
}
// Not a typo :)
fn emit_for_for_loop (&mut self, for_loop: &ASTForLoop) {
self.conditional_code_depth += 1;
// Alloc a higher scope for the loop counter - it can be
// shadowed from within
self.begin_var_scope();
if let Some(declaration) = &for_loop.declaration {
self.emit_for_node(declaration);
}
let start_label = self.get_unique_label("for_start");
let end_label = self.get_unique_label("for_end");
self.emit(format!("{}:", start_label));
if let Some(condition) = &for_loop.condition {
self.emit_for_node(condition);
} else {
// If condition is empty, it's truthy
self.emit_str("mov $1, %rax");
}
self.emit_str("cmp $0, %rax");
self.emit(format!("je {}", end_label));
self.emit_for_node(&for_loop.body);
if let Some(modification) = &for_loop.modification {
self.emit_for_node(modification);
}
self.emit(format!("jmp {}", start_label));
self.emit(format!("{}:", end_label));
self.end_runtime_var_scope(true);
self.end_compiletime_var_scope();
self.conditional_code_depth -= 1;
}
fn emit_for_variable_declaration (&mut self, var: &ASTVariableDeclaration) {
// If there's an initial value, we'll put it in eax, if not we'll
// shove whatever random vallue we were last using in there (it's UB)
if self.var_context.len() == 1 {
// If only the global context exists, this is a global variable
let constant_value = match &var.initial_value {
Some(init) => get_constant_value_from_node(init),
None => 0,
};
self.emit_global_alloc_from_constant(
&ASTNameAndType {
name: var.identifier.clone(),
param_type: var.var_type.clone()
},
constant_value
);
} else {
// Else it is a local (stack) variable
if let Some(init) = &var.initial_value {
self.emit_for_node(init);
}
self.emit_stack_alloc_from_rax(&ASTNameAndType {
name: var.identifier.clone(),
param_type: var.var_type.clone()
});
}
}
fn emit_for_binary_operation (&mut self, bin: &ASTBinaryOperation) {
if is_binary_stack_operator(&bin.operator) {
// Emit stack precursor
self.emit_for_node(&bin.left_side);
self.emit_str("push %rax");
self.emit_for_node(&bin.right_side);
self.emit_str("pop %rcx");
match &bin.operator[..] {
"+" => self.emit_str("addl %ecx, %eax"),
"-" => {
self.emit_str("subl %eax, %ecx");
self.emit_str("movl %ecx, %eax")
},
"*" => self.emit_str("imul %ecx, %eax"),
"/" => {
self.emit_str("movl %eax, %r8d");
self.emit_str("movl %ecx, %eax");
self.emit_str("cdq");
self.emit_str("idivl %r8d");
},
"%" => {
// TODO: Share more code between / and %
self.emit_str("movl %eax, %r8d");
self.emit_str("movl %ecx, %eax");
self.emit_str("cdq");
self.emit_str("idivl %r8d");
self.emit_str("mov %rdx, %rax");
},
"==" => {
self.emit_for_comparison_precursor();
self.emit_str("sete %al");
},
"!=" => {
self.emit_for_comparison_precursor();
self.emit_str("setne %al");
},
">" => {
self.emit_for_comparison_precursor();
self.emit_str("setg %al");
},
"<" => {
self.emit_for_comparison_precursor();
self.emit_str("setl %al");
},
">=" => {
self.emit_for_comparison_precursor();
self.emit_str("setge %al");
},
"<=" => {
self.emit_for_comparison_precursor();
self.emit_str("setle %al");
},
_ => unimplemented!("\"{}\" stack operator", bin.operator)
}
return;
}
match &bin.operator[..] {
// Short-circuiting OR implementation
"||" => {
self.emit_for_node(&bin.left_side);
let skip_label = self.get_unique_label("skip");
let end_label = self.get_unique_label("end");
self.emit_str("cmpl $0, %eax");
// If exp1 was false, we need to jump to evaluating exp2
self.emit(format!("je {}", skip_label));
// Otherwise, we set eax to true and skip to the end
self.emit_str("movl $1, %eax");
self.emit(format!("jmp {}", end_label));
self.emit(format!("{}:", skip_label));
self.emit_for_node(&bin.right_side);
// Now we compare eax to 0 and set eax to the opposite of that comparison
self.emit_str("cmpl $0, %eax");
self.emit_str("movl $0, %eax");
self.emit_str("setne %al");
self.emit(format!("{}:", end_label));
},
// Short circuiting AND implementation, very similar to OR
"&&" => {
self.emit_for_node(&bin.left_side);
let skip_label = self.get_unique_label("skip");
let end_label = self.get_unique_label("end");
self.emit_str("cmpl $0, %eax");
self.emit(format!("jne {}", skip_label));
self.emit(format!("jmp {}", end_label));
self.emit(format!("{}:", skip_label));
self.emit_for_node(&bin.right_side);
self.emit_str("cmp $0, %rax");
self.emit_str("mov $0, %rax");
self.emit_str("setne %al");
self.emit(format!("{}:", end_label))
},
// Assignemnts (remember these are expressions with a value!)
"=" => {
let loc = self.get_stored_value_location(self.find_node(&bin.left_side));
self.emit_for_node(&bin.right_side);
self.emit(format!("mov %rax, {}", loc));
},
_ => unimplemented!("\"{}\" non-stack operator", bin.operator)
}
}
fn find_node (&self, node: &ASTNode) -> &StoredValue {
match &node {
ASTNode::Identifier(ident) => self.find_var(ident),
_ => panic!("Cannot resolve non-identifier assignable")
}
}
fn emit_for_comparison_precursor (&mut self) {
self.emit_str("cmp %rax, %rcx");
self.emit_str("mov $0, %rax");
}
fn emit_for_unary_operation (&mut self, unar: &ASTUnaryOperation) {
if is_pointer_operator(&unar.operator) {
let value = self.find_node(&unar.operand).clone();
match &unar.operator[..] {
"&" => {
self.emit_load_address_of_stored_value(&value);
},
"*" => {
self.emit_for_stored_value_access(&value);
self.emit_str("movq (%rax), %rax");
},
_ => unimplemented!("Pointer operator {}", unar.operator)
}
} else {
self.emit_for_node(&unar.operand);
match &unar.operator[..] {
"-" => {
self.emit_str("neg %eax")
},
"~" => {
self.emit_str("not %eax")
},
"!" => {
self.emit_str("cmp $0, %rax");
self.emit_str("mov $0, %rax");
self.emit_str("setz %al");
},
_ => panic!("Codegen unimplemented for unary operator \"{}\"", unar.operator)
}
}
}
fn emit_function_prologue (&mut self) {
// Save the old base pointer
self.emit_str("push %rbp");
// The stack head is the new base
self.emit_str("mov %rsp, %rbp");
}
fn emit_function_epilogue (&mut self, gen_return_value: bool) {
if gen_return_value {
// Functions without a return statement return 0
self.emit_str("mov $0, %rax");
}
// Stack head is the base
self.emit_str("mov %rbp, %rsp");
// Restore the old base
self.emit_str("pop %rbp");
// Jump out of func
self.emit_str("ret");
}
fn get_unique_label (&mut self, comment: &str) -> String {
self.counter += 1;
format!("_{}_{}", comment, self.counter)
}
pub fn emit_str (&mut self, st: &str) {
self.emit(st.to_string())
}
pub fn emit (&mut self, st: String) {
self.generated = format!("{}{}\n", self.generated, st)
}
pub fn new (ast: Vec<ASTNode>) -> Codegen {
Codegen {
ast,
generated: String::from(""),
counter: 0,
var_context: vec![],
stack_offset: 0,
block_depth: 0,
conditional_code_depth: 0,
func_has_unconditional_return: false
}
}
}
|
use crate::qrcode::QrCodeScanner;
use flutter_plugins::prelude::*;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
const PLUGIN_NAME: &str = module_path!();
const CHANNEL_NAME: &str = "rust/qrcode";
#[derive(Default)]
pub struct QrCodePlugin {
handler: Arc<RwLock<Handler>>,
}
#[derive(Default)]
struct Handler {
handle: Option<Handle>,
stop_trigger: Arc<AtomicBool>,
}
impl Plugin for QrCodePlugin {
fn plugin_name() -> &'static str {
PLUGIN_NAME
}
fn init_channels(&mut self, registrar: &mut ChannelRegistrar) {
let event_handler = Arc::downgrade(&self.handler);
registrar.register_channel(EventChannel::new(CHANNEL_NAME, event_handler));
}
}
impl EventHandler for Handler {
fn on_listen(
&mut self,
_value: Value,
engine: FlutterEngine,
) -> Result<Value, MethodCallError> {
if let Some(handle) = &self.handle {
send_event(engine, Event::Initialized(handle.clone()))?;
return Ok(Value::Null);
}
// create texture
let texture = engine.create_texture();
let texture_id = texture.id();
// create scanner
let mut scanner = QrCodeScanner::new(texture)?;
let handle = Handle {
texture_id,
width: scanner.width() as _,
height: scanner.height() as _,
};
self.handle = Some(handle.clone());
send_event(engine.clone(), Event::Initialized(handle))?;
let stop_trigger = Arc::new(AtomicBool::new(false));
self.stop_trigger = stop_trigger.clone();
engine.clone().run_in_background(async move {
while !stop_trigger.load(Ordering::Relaxed) {
match scanner.frame() {
Ok(Some(code)) => send_event(engine.clone(), Event::QrCode(code)).unwrap(),
Err(err) => send_error(engine.clone(), &err),
_ => {}
}
}
drop(scanner);
send_event(engine, Event::Disposed).unwrap();
});
Ok(Value::Null)
}
fn on_cancel(&mut self, _engine: FlutterEngine) -> Result<Value, MethodCallError> {
self.stop_trigger.store(true, Ordering::Relaxed);
self.handle = None;
Ok(Value::Null)
}
}
fn send_event(engine: FlutterEngine, event: Event) -> Result<(), MethodCallError> {
log::debug!("event: {:?}", event);
let value = to_value(event)?;
engine.run_on_platform_thread(move |engine| {
engine.with_channel(CHANNEL_NAME, |channel| {
if let Some(channel) = channel.try_as_method_channel() {
channel.send_success_event(&value);
}
});
});
Ok(())
}
fn send_error(engine: FlutterEngine, error: &dyn std::error::Error) {
let message = format!("{}", error);
log::error!("{}", &message);
engine.run_on_platform_thread(move |engine| {
engine.with_channel(CHANNEL_NAME, move |channel| {
if let Some(channel) = channel.try_as_method_channel() {
channel.send_error_event("", &message, &Value::Null);
}
});
});
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
struct Handle {
texture_id: i64,
width: i64,
height: i64,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
enum Event {
Initialized(Handle),
QrCode(String),
Disposed,
}
#[derive(Debug)]
struct UninitializedError;
impl std::fmt::Display for UninitializedError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "scanner was not initialized")
}
}
impl std::error::Error for UninitializedError {}
impl From<UninitializedError> for MethodCallError {
fn from(error: UninitializedError) -> Self {
Self::from_error(error)
}
}
|
#[cfg(target_os = "macos")]
fn main() {
println!("cargo:rustc-link-lib=framework=IOKit");
println!("cargo:rustc-link-lib=framework=CoreFoundation");
}
#[cfg(not(target_os = "macos"))]
fn main() {}
|
use std::fs;
fn main() {
let data = fs::read("/etc/hosts")
.expect("Unable to read file");
println!("{}", data.len());
}
|
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Module holding different kinds of pseudo files and their building blocks.
use {
crate::directory::entry::DirectoryEntry,
libc::{S_IRUSR, S_IWUSR},
};
pub mod asynchronous;
pub mod simple;
/// A base trait for all the pseudo files. Most clients will probably just use the DirectoryEntry
/// trait to deal with the pseudo files uniformly.
pub trait PseudoFile: DirectoryEntry {}
/// POSIX emulation layer access attributes set by default for files created with read_only().
pub const DEFAULT_READ_ONLY_PROTECTION_ATTRIBUTES: u32 = S_IRUSR;
/// POSIX emulation layer access attributes set by default for files created with write_only().
pub const DEFAULT_WRITE_ONLY_PROTECTION_ATTRIBUTES: u32 = S_IWUSR;
/// POSIX emulation layer access attributes set by default for files created with read_write().
pub const DEFAULT_READ_WRITE_PROTECTION_ATTRIBUTES: u32 =
DEFAULT_READ_ONLY_PROTECTION_ATTRIBUTES | DEFAULT_WRITE_ONLY_PROTECTION_ATTRIBUTES;
pub mod test_utils;
mod common;
mod connection;
|
#[macro_use]
extern crate lazy_static;
extern crate log as log_crate;
extern crate poe_alloc;
pub mod allocator {
pub use poe_alloc::PoeAlloc;
pub const POE_ALLOC: PoeAlloc = PoeAlloc {};
}
pub mod env;
pub mod io;
pub mod log;
mod resource;
pub use resource::Resource;
|
extern crate cortex_m;
use super::PERIPH;
use boards::nrf51dk::BUTTONS;
pub struct Button {
pub i: usize,
}
impl Button {
pub fn init() {
cortex_m::interrupt::free(|cs| {
if let Some(p) = PERIPH.borrow(cs).borrow().as_ref() {
//configure pins in pull up input mode
//todo change this to a macro?
let mut i: usize = 0;
for button in &BUTTONS {
p.GPIO.pin_cnf[button.i].write(|w| {
w.dir()
.input()
.drive()
.s0s1()
.pull()
.pullup()
.sense()
.disabled()
.input()
.connect()
});
p.GPIOTE.config[i].write(|w| unsafe { w.mode().event().psel().bits(button.i as u8).polarity().lo_to_hi()});
p.GPIOTE.events_in[i].write(|w| unsafe { w.bits(0) });
i += 1;
}
p.GPIOTE.intenset.write(|w| w.in0().set_bit());
p.GPIOTE.intenset.write(|w| w.in1().set_bit());
p.GPIOTE.intenset.write(|w| w.in2().set_bit());
p.GPIOTE.intenset.write(|w| w.in3().set_bit());
}
});
}
} |
use std::borrow::Cow;
use std::hash::Hash;
use std::ops::Range;
/// Reference to a [`DiffableStr`].
///
/// This type exists because while the library only really provides ways to
/// work with `&str` and `&[u8]` there are types that deref into those string
/// slices such as `String` and `Vec<u8>`.
///
/// This trait is used in the library whenever it's nice to be able to pass
/// strings of different types in.
///
/// Requires the `text` feature.
pub trait DiffableStrRef {
/// The type of the resolved [`DiffableStr`].
type Output: DiffableStr + ?Sized;
/// Resolves the reference.
fn as_diffable_str(&self) -> &Self::Output;
}
impl<T: DiffableStr + ?Sized> DiffableStrRef for T {
type Output = T;
fn as_diffable_str(&self) -> &T {
self
}
}
impl DiffableStrRef for String {
type Output = str;
fn as_diffable_str(&self) -> &str {
self.as_str()
}
}
impl<'a, T: DiffableStr + ?Sized> DiffableStrRef for Cow<'a, T> {
type Output = T;
fn as_diffable_str(&self) -> &T {
self
}
}
/// All supported diffable strings.
///
/// The text module can work with different types of strings depending
/// on how the crate is compiled. Out of the box `&str` is always supported
/// but with the `bytes` feature one can also work with `[u8]` slices for
/// as long as they are ASCII compatible.
///
/// Requires the `text` feature.
pub trait DiffableStr: Hash + PartialEq + PartialOrd + Ord + Eq + ToOwned {
/// Splits the value into newlines with newlines attached.
fn tokenize_lines(&self) -> Vec<&Self>;
/// Splits the value into newlines with newlines separated.
fn tokenize_lines_and_newlines(&self) -> Vec<&Self>;
/// Tokenizes into words.
fn tokenize_words(&self) -> Vec<&Self>;
/// Tokenizes the input into characters.
fn tokenize_chars(&self) -> Vec<&Self>;
/// Tokenizes into unicode words.
#[cfg(feature = "unicode")]
fn tokenize_unicode_words(&self) -> Vec<&Self>;
/// Tokenizes into unicode graphemes.
#[cfg(feature = "unicode")]
fn tokenize_graphemes(&self) -> Vec<&Self>;
/// Decodes the string (potentially) lossy.
fn as_str(&self) -> Option<&str>;
/// Decodes the string (potentially) lossy.
fn to_string_lossy(&self) -> Cow<'_, str>;
/// Checks if the string ends in a newline.
fn ends_with_newline(&self) -> bool;
/// The length of the string.
fn len(&self) -> usize;
/// Slices the string.
fn slice(&self, rng: Range<usize>) -> &Self;
/// Returns the string as slice of raw bytes.
fn as_bytes(&self) -> &[u8];
/// Checks if the string is empty.
fn is_empty(&self) -> bool {
self.len() == 0
}
}
impl DiffableStr for str {
fn tokenize_lines(&self) -> Vec<&Self> {
let mut iter = self.char_indices().peekable();
let mut last_pos = 0;
let mut lines = vec![];
while let Some((idx, c)) = iter.next() {
if c == '\r' {
if iter.peek().map_or(false, |x| x.1 == '\n') {
lines.push(&self[last_pos..=idx + 1]);
iter.next();
last_pos = idx + 2;
} else {
lines.push(&self[last_pos..=idx]);
last_pos = idx + 1;
}
} else if c == '\n' {
lines.push(&self[last_pos..=idx]);
last_pos = idx + 1;
}
}
if last_pos < self.len() {
lines.push(&self[last_pos..]);
}
lines
}
fn tokenize_lines_and_newlines(&self) -> Vec<&Self> {
let mut rv = vec![];
let mut iter = self.char_indices().peekable();
while let Some((idx, c)) = iter.next() {
let is_newline = c == '\r' || c == '\n';
let start = idx;
let mut end = idx + c.len_utf8();
while let Some(&(_, next_char)) = iter.peek() {
if (next_char == '\r' || next_char == '\n') != is_newline {
break;
}
iter.next();
end += next_char.len_utf8();
}
rv.push(&self[start..end]);
}
rv
}
fn tokenize_words(&self) -> Vec<&Self> {
let mut iter = self.char_indices().peekable();
let mut rv = vec![];
while let Some((idx, c)) = iter.next() {
let is_whitespace = c.is_whitespace();
let start = idx;
let mut end = idx + c.len_utf8();
while let Some(&(_, next_char)) = iter.peek() {
if next_char.is_whitespace() != is_whitespace {
break;
}
iter.next();
end += next_char.len_utf8();
}
rv.push(&self[start..end]);
}
rv
}
fn tokenize_chars(&self) -> Vec<&Self> {
self.char_indices()
.map(move |(i, c)| &self[i..i + c.len_utf8()])
.collect()
}
#[cfg(feature = "unicode")]
fn tokenize_unicode_words(&self) -> Vec<&Self> {
unicode_segmentation::UnicodeSegmentation::split_word_bounds(self).collect()
}
#[cfg(feature = "unicode")]
fn tokenize_graphemes(&self) -> Vec<&Self> {
unicode_segmentation::UnicodeSegmentation::graphemes(self, true).collect()
}
fn as_str(&self) -> Option<&str> {
Some(self)
}
fn to_string_lossy(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}
fn ends_with_newline(&self) -> bool {
self.ends_with(&['\r', '\n'][..])
}
fn len(&self) -> usize {
str::len(self)
}
fn slice(&self, rng: Range<usize>) -> &Self {
&self[rng]
}
fn as_bytes(&self) -> &[u8] {
str::as_bytes(self)
}
}
#[cfg(feature = "bytes")]
mod bytes_support {
use super::*;
use bstr::ByteSlice;
impl DiffableStrRef for Vec<u8> {
type Output = [u8];
fn as_diffable_str(&self) -> &[u8] {
self.as_slice()
}
}
/// Allows viewing ASCII compatible byte slices as strings.
///
/// Requires the `bytes` feature.
impl DiffableStr for [u8] {
fn tokenize_lines(&self) -> Vec<&Self> {
let mut iter = self.char_indices().peekable();
let mut last_pos = 0;
let mut lines = vec![];
while let Some((_, end, c)) = iter.next() {
if c == '\r' {
if iter.peek().map_or(false, |x| x.2 == '\n') {
lines.push(&self[last_pos..end + 1]);
iter.next();
last_pos = end + 1;
} else {
lines.push(&self[last_pos..end]);
last_pos = end;
}
} else if c == '\n' {
lines.push(&self[last_pos..end]);
last_pos = end;
}
}
if last_pos < self.len() {
lines.push(&self[last_pos..]);
}
lines
}
fn tokenize_lines_and_newlines(&self) -> Vec<&Self> {
let mut rv = vec![];
let mut iter = self.char_indices().peekable();
while let Some((start, mut end, c)) = iter.next() {
let is_newline = c == '\r' || c == '\n';
while let Some(&(_, new_end, next_char)) = iter.peek() {
if (next_char == '\r' || next_char == '\n') != is_newline {
break;
}
iter.next();
end = new_end;
}
rv.push(&self[start..end]);
}
rv
}
fn tokenize_words(&self) -> Vec<&Self> {
let mut iter = self.char_indices().peekable();
let mut rv = vec![];
while let Some((start, mut end, c)) = iter.next() {
let is_whitespace = c.is_whitespace();
while let Some(&(_, new_end, next_char)) = iter.peek() {
if next_char.is_whitespace() != is_whitespace {
break;
}
iter.next();
end = new_end;
}
rv.push(&self[start..end]);
}
rv
}
#[cfg(feature = "unicode")]
fn tokenize_unicode_words(&self) -> Vec<&Self> {
self.words_with_breaks().map(|x| x.as_bytes()).collect()
}
#[cfg(feature = "unicode")]
fn tokenize_graphemes(&self) -> Vec<&Self> {
self.graphemes().map(|x| x.as_bytes()).collect()
}
fn tokenize_chars(&self) -> Vec<&Self> {
self.char_indices()
.map(move |(start, end, _)| &self[start..end])
.collect()
}
fn as_str(&self) -> Option<&str> {
std::str::from_utf8(self).ok()
}
fn to_string_lossy(&self) -> Cow<'_, str> {
String::from_utf8_lossy(self)
}
fn ends_with_newline(&self) -> bool {
if let Some(b'\r') | Some(b'\n') = self.last_byte() {
true
} else {
false
}
}
fn len(&self) -> usize {
<[u8]>::len(self)
}
fn slice(&self, rng: Range<usize>) -> &Self {
&self[rng]
}
fn as_bytes(&self) -> &[u8] {
self
}
}
}
#[test]
fn test_split_lines() {
assert_eq!(
DiffableStr::tokenize_lines("first\nsecond\rthird\r\nfourth\nlast"),
vec!["first\n", "second\r", "third\r\n", "fourth\n", "last"]
);
assert_eq!(DiffableStr::tokenize_lines("\n\n"), vec!["\n", "\n"]);
assert_eq!(DiffableStr::tokenize_lines("\n"), vec!["\n"]);
assert!(DiffableStr::tokenize_lines("").is_empty());
}
#[test]
fn test_split_words() {
assert_eq!(
DiffableStr::tokenize_words("foo bar baz\n\n aha"),
["foo", " ", "bar", " ", "baz", "\n\n ", "aha"]
);
}
#[test]
fn test_split_chars() {
assert_eq!(
DiffableStr::tokenize_chars("abcfö❄️"),
vec!["a", "b", "c", "f", "ö", "❄", "\u{fe0f}"]
);
}
#[test]
#[cfg(feature = "unicode")]
fn test_split_graphemes() {
assert_eq!(
DiffableStr::tokenize_graphemes("abcfö❄️"),
vec!["a", "b", "c", "f", "ö", "❄️"]
);
}
#[test]
#[cfg(feature = "bytes")]
fn test_split_lines_bytes() {
assert_eq!(
DiffableStr::tokenize_lines("first\nsecond\rthird\r\nfourth\nlast".as_bytes()),
vec![
"first\n".as_bytes(),
"second\r".as_bytes(),
"third\r\n".as_bytes(),
"fourth\n".as_bytes(),
"last".as_bytes()
]
);
assert_eq!(
DiffableStr::tokenize_lines("\n\n".as_bytes()),
vec!["\n".as_bytes(), "\n".as_bytes()]
);
assert_eq!(
DiffableStr::tokenize_lines("\n".as_bytes()),
vec!["\n".as_bytes()]
);
assert!(DiffableStr::tokenize_lines("".as_bytes()).is_empty());
}
#[test]
#[cfg(feature = "bytes")]
fn test_split_words_bytes() {
assert_eq!(
DiffableStr::tokenize_words("foo bar baz\n\n aha".as_bytes()),
[
&b"foo"[..],
&b" "[..],
&b"bar"[..],
&b" "[..],
&b"baz"[..],
&b"\n\n "[..],
&b"aha"[..]
]
);
}
#[test]
#[cfg(feature = "bytes")]
fn test_split_chars_bytes() {
assert_eq!(
DiffableStr::tokenize_chars("abcfö❄️".as_bytes()),
vec![
&b"a"[..],
&b"b"[..],
&b"c"[..],
&b"f"[..],
"ö".as_bytes(),
"❄".as_bytes(),
"\u{fe0f}".as_bytes()
]
);
}
#[test]
#[cfg(all(feature = "bytes", feature = "unicode"))]
fn test_split_graphemes_bytes() {
assert_eq!(
DiffableStr::tokenize_graphemes("abcfö❄️".as_bytes()),
vec![
&b"a"[..],
&b"b"[..],
&b"c"[..],
&b"f"[..],
"ö".as_bytes(),
"❄️".as_bytes()
]
);
}
|
use crate::schema::projetos_ensino;
use chrono::NaiveDateTime;
#[derive(Serialize, Deserialize, Queryable)]
pub struct ProjetosEnsino {
pub id: i32,
pub id_professor: i32,
pub titulo: String,
pub numero_edital: i32,
pub ano_edital: i32,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
}
#[derive(Deserialize, Insertable)]
#[table_name = "projetos_ensino"]
pub struct InsertableProjetoEnsino {
pub id_professor: i32,
pub titulo: String,
pub numero_edital: i32,
pub ano_edital: i32,
}
/*
projetos_ensino (id) {
id -> Integer,
id_professor -> Integer,
titulo -> Varchar,
numero_edital -> Integer,
ano_edital -> Integer,
created_at -> Datetime,
updated_at -> Datetime,
}
*/
|
pub mod benchmarks;
#[cfg(not(feature = "ouroboros_compare"))]
pub mod self_cell_cells;
#[cfg(feature = "ouroboros_compare")]
pub mod ouroboros_cells;
|
use objects::*;
use types::init_types;
use std::hashmap::HashMap;
type GlobalEnv = HashMap<~str, SchemeObject>;
#[deriving(Eq, Clone)]
pub struct SchemeEnv {
// TODO: Hashmap?
// TODO: max size?
symbols: ~[SchemeObject],
values: ~[SchemeObject],
globals: GlobalEnv,
next: Option<~SchemeEnv>
}
impl SchemeEnv {
pub fn new() -> SchemeEnv {
SchemeEnv {
symbols: ~[],
values: ~[],
globals: HashMap::new(),
next: None
}
}
pub fn basic_env() -> SchemeEnv {
let mut env = SchemeEnv::new();
init_types();
env
}
pub fn add_global(&mut self, name: &str, obj: &SchemeObject) {
self.globals.insert(name.to_owned(), obj.clone());
}
pub fn add_binding(&mut self, sym: &SchemeObject, val: &SchemeObject) {
if self.next.is_none() {
fail!("Cannot add a binding to the top-level environment");
}
self.symbols.push(sym.clone());
self.values.push(val.clone());
}
pub fn extend(&mut self, env: ~SchemeEnv) {
self.globals = env.globals.clone();
self.next = Some(env);
}
pub fn add_frame(&mut self, syms: &SchemeObject, vals: &SchemeObject) -> SchemeEnv {
let mut syms = syms.clone();
let mut vals = vals.clone();
let mut frame = SchemeEnv::new();
// TODO: list iterator?
let len = syms.list_len();
for i in range(0, len) {
if syms.is_symbol() {
frame.symbols.push(syms.clone());
frame.values.push(vals.clone());
} else {
frame.symbols.push(*syms.car());
frame.values.push(*vals.car());
syms = *syms.cdr();
vals = *vals.cdr();
}
}
frame.globals = self.globals.clone();
frame.next = Some(~self.clone());
//TODO: need to update a global environment?
// probably should try to avoid that...
frame
}
pub fn pop_frame(self) -> SchemeEnv {
assert!(self.next.is_some());
*self.next.clone().unwrap()
}
// TODO: should not need to clone the environment on each iteration.
pub fn set_value(&mut self, symbol: &SchemeObject, val: &SchemeObject) {
let mut frame = self.clone();
while frame.next.is_some() {
for i in range(0, self.symbols.len()) {
if (symbol == &frame.symbols[i]) {
frame.values[i] = val.clone();
return;
}
}
frame = frame.pop_frame().clone();
}
let sym_str = symbol.symbol_str().clone();
if frame.lookup_global(symbol).is_some() {
frame.globals.insert(sym_str, val.clone());
} else {
fail!("set!: unbound variable: {}", sym_str);
}
}
pub fn lookup_value(&self, symbol: &SchemeObject) -> Option<SchemeObject> {
let mut frame = self.clone();
while frame.next.is_some() {
for i in range(0, self.symbols.len()) {
if (symbol == &frame.symbols[i]) {
return Some(frame.values[i].clone());
}
}
frame = frame.pop_frame().clone();
}
frame.lookup_global(symbol)
}
pub fn lookup_global(&self, symbol: &SchemeObject) -> Option<SchemeObject> {
self.globals.find_copy(&symbol.symbol_str())
}
}
#[cfg(test)]
mod test {
use super::*;
use objects::*;
#[test]
fn test_scheme_one_level_global() {
let mut env = SchemeEnv::new();
env.add_global("g0", &SchemeObject::new_int(5));
assert_eq!(env.lookup_global(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(5));
assert_eq!(env.lookup_value(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(5));
}
#[test]
#[should_fail]
fn test_scheme_one_level_binding() {
let mut env = SchemeEnv::new();
let sym = SchemeObject::new_symbol(~"bind0");
env.add_binding(&sym, &SchemeObject::new_int(5));
}
#[test]
fn test_scheme_two_level_bindings() {
let mut env = SchemeEnv::new();
env.add_global("g0", &SchemeObject::new_int(3));
let sym0 = SchemeObject::new_symbol(~"bind0");
let val0 = SchemeObject::new_int(5);
let sym1 = SchemeObject::new_symbol(~"bind1");
let val1 = SchemeObject::new_int(7);
let syms = SchemeObject::new_list(~[~sym0.clone(), ~sym1.clone()]);
let vals = SchemeObject::new_list(~[~val0.clone(), ~val1.clone()]);
let new_env = env.add_frame(~syms, ~vals);
assert_eq!(new_env.lookup_value(&sym0).unwrap(), val0);
assert_eq!(new_env.lookup_value(&sym1).unwrap(), val1);
assert_eq!(env.lookup_value(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(3));
assert_eq!(env.lookup_global(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(3));
assert_eq!(new_env.lookup_value(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(3));
assert_eq!(new_env.lookup_global(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(3));
let popped = new_env.pop_frame();
assert!(popped.lookup_value(&sym0).is_none());
assert!(popped.lookup_value(&sym1).is_none());
assert_eq!(popped.lookup_value(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(3));
assert_eq!(popped.lookup_global(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(3));
assert_eq!(popped.lookup_value(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(3));
assert_eq!(popped.lookup_global(&SchemeObject::new_symbol(~"g0")).unwrap(),
SchemeObject::new_int(3));
assert_eq!(popped, env);
}
// TODO: more test coverage
}
|
#[cfg(test)]
mod test;
use liblumen_alloc::erts::process::Process;
use liblumen_alloc::erts::term::prelude::*;
use crate::runtime::scheduler::SchedulerDependentAlloc;
#[native_implemented::function(erlang:make_ref/0)]
pub fn result(process: &Process) -> Term {
process.next_reference()
}
|
use crate::errors::ApiError;
use actix_web::web::Json;
use serde::Serialize;
/// Helper function to reduce boilerplate of an OK/Json response
pub fn respond_json<T>(data: T) -> Result<Json<T>, ApiError>
where
T: Serialize,
{
Ok(Json(data))
}
#[cfg(test)]
mod tests {
use super::*;
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub struct TestResponse {
pub first_name: String,
}
#[test]
fn it_responds_json() {
let response = TestResponse {
first_name: "Satoshi".into(),
};
let result = respond_json(response.clone());
assert!(result.is_ok());
assert_eq!(result.unwrap().into_inner(), response);
}
}
|
use eosio::*;
use eosio_cdt::*;
use std::marker::PhantomData;
#[eosio::action]
pub fn exec(
executer: PhantomData<AccountName>,
trx: PhantomData<Transaction<Vec<u8>>>,
) {
require_auth(current_receiver());
let mut ds = current_data_stream();
let executer = ds.read::<AccountName>().expect("read");
require_auth(executer);
let id: TransactionId = {
let now = current_time_point().as_micros() as u128;
let value = u128::from(executer.as_u64()) << 64 | now;
value.into()
};
let bytes = ds.as_remaining_bytes().unwrap();
send_deferred_bytes(id, executer, bytes, false);
}
eosio_cdt::abi!(exec);
|
//! The `generators` module contains API for producing a
//! set of generators for a rangeproof.
#![allow(non_snake_case)]
#![deny(missing_docs)]
// XXX we should use Sha3 everywhere
use sha2::{Digest, Sha512};
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
use curve25519_dalek::traits::MultiscalarMul;
/// The `GeneratorsChain` creates an arbitrary-long sequence of orthogonal generators.
/// The sequence can be deterministically produced starting with an arbitrary point.
struct GeneratorsChain {
next_point: RistrettoPoint,
}
impl GeneratorsChain {
/// Creates a chain of generators, determined by the hash of `label`.
fn new(label: &[u8]) -> Self {
let mut hash = Sha512::default();
hash.input(b"GeneratorsChainInit");
hash.input(label);
let next_point = RistrettoPoint::from_hash(hash);
GeneratorsChain { next_point }
}
}
impl Default for GeneratorsChain {
fn default() -> Self {
Self::new(&[])
}
}
impl Iterator for GeneratorsChain {
type Item = RistrettoPoint;
fn next(&mut self) -> Option<Self::Item> {
let current_point = self.next_point;
let mut hash = Sha512::default();
hash.input(b"GeneratorsChainNext");
hash.input(current_point.compress().as_bytes());
self.next_point = RistrettoPoint::from_hash(hash);
Some(current_point)
}
}
/// The `Generators` struct contains all the generators needed for
/// aggregating `m` range proofs of `n` bits each.
#[derive(Clone)]
pub struct Generators {
/// Number of bits in a rangeproof
pub n: usize,
/// Number of values or parties
pub m: usize,
/// Bases for Pedersen commitments
pub pedersen_generators: PedersenGenerators,
/// Per-bit generators for the bit values
pub G: Vec<RistrettoPoint>,
/// Per-bit generators for the bit blinding factors
pub H: Vec<RistrettoPoint>,
}
/// The `GeneratorsView` is produced by `Generators::share()`.
///
/// The `Generators` struct represents generators for an aggregated
/// range proof `m` proofs of `n` bits each; the `GeneratorsView`
/// represents the generators for one of the `m` parties' shares.
#[derive(Copy, Clone)]
pub struct GeneratorsView<'a> {
/// Bases for Pedersen commitments
pub pedersen_generators: &'a PedersenGenerators,
/// Per-bit generators for the bit values
pub G: &'a [RistrettoPoint],
/// Per-bit generators for the bit blinding factors
pub H: &'a [RistrettoPoint],
}
/// Represents a pair of base points for Pedersen commitments.
#[derive(Copy, Clone)]
pub struct PedersenGenerators {
/// Base for the committed value
pub B: RistrettoPoint,
/// Base for the blinding factor
pub B_blinding: RistrettoPoint,
}
impl PedersenGenerators {
/// Creates a Pedersen commitment using the value scalar and a blinding factor.
pub fn commit(&self, value: Scalar, blinding: Scalar) -> RistrettoPoint {
RistrettoPoint::multiscalar_mul(&[value, blinding], &[self.B, self.B_blinding])
}
}
impl Default for PedersenGenerators {
fn default() -> Self {
PedersenGenerators {
B: GeneratorsChain::new(b"Bulletproofs.Generators.B")
.next()
.unwrap(),
B_blinding: GeneratorsChain::new(b"Bulletproofs.Generators.B_blinding")
.next()
.unwrap(),
}
}
}
impl Generators {
/// Creates generators for `m` range proofs of `n` bits each.
pub fn new(pedersen_generators: PedersenGenerators, n: usize, m: usize) -> Self {
let G = GeneratorsChain::new(pedersen_generators.B.compress().as_bytes())
.take(n * m)
.collect();
let H = GeneratorsChain::new(pedersen_generators.B_blinding.compress().as_bytes())
.take(n * m)
.collect();
Generators {
pedersen_generators,
n,
m,
G,
H,
}
}
/// Returns j-th share of generators, with an appropriate
/// slice of vectors G and H for the j-th range proof.
pub fn share(&self, j: usize) -> GeneratorsView {
let lower = self.n * j;
let upper = self.n * (j + 1);
GeneratorsView {
pedersen_generators: &self.pedersen_generators,
G: &self.G[lower..upper],
H: &self.H[lower..upper],
}
}
}
#[cfg(test)]
mod tests {
extern crate hex;
use super::*;
#[test]
fn rangeproof_generators() {
let n = 2;
let m = 3;
let gens = Generators::new(PedersenGenerators::default(), n, m);
// The concatenation of shares must be the full generator set
assert_eq!(
[gens.G[..n].to_vec(), gens.H[..n].to_vec()],
[gens.share(0).G[..].to_vec(), gens.share(0).H[..].to_vec()]
);
assert_eq!(
[gens.G[n..][..n].to_vec(), gens.H[n..][..n].to_vec()],
[gens.share(1).G[..].to_vec(), gens.share(1).H[..].to_vec()]
);
assert_eq!(
[gens.G[2 * n..][..n].to_vec(), gens.H[2 * n..][..n].to_vec()],
[gens.share(2).G[..].to_vec(), gens.share(2).H[..].to_vec()]
);
}
}
|
//! Plumbing used to expose external functions written in rust to LLVM.
//!
//! The core data-structure here is [`IntrinsicMap`], which lazily decalres external functions
//! based on a type signature.
use super::attr;
use crate::codegen::FunctionAttr;
use crate::common::Either;
use crate::compile::Ty;
use hashbrown::HashMap;
use libc::c_void;
use llvm_sys::{
self,
prelude::{LLVMContextRef, LLVMModuleRef, LLVMTypeRef, LLVMValueRef},
support::LLVMAddSymbol,
};
use smallvec;
use std::cell::RefCell;
struct Intrinsic {
name: *const libc::c_char,
data: RefCell<Either<LLVMTypeRef, LLVMValueRef>>,
attrs: smallvec::SmallVec<[FunctionAttr; 1]>,
func: *mut c_void,
}
// A map of intrinsics that lazily declares them when they are used in codegen.
pub(crate) struct IntrinsicMap {
module: LLVMModuleRef,
ctx: LLVMContextRef,
map: HashMap<usize, Intrinsic>,
}
impl IntrinsicMap {
pub(crate) fn new(module: LLVMModuleRef, ctx: LLVMContextRef) -> IntrinsicMap {
IntrinsicMap {
ctx,
module,
map: Default::default(),
}
}
pub(crate) unsafe fn map_drop_fn(&self, ty: Ty) -> Option<LLVMValueRef> {
use Ty::*;
match ty {
MapIntInt => Some(self.get(external!(drop_intint))),
MapIntFloat => Some(self.get(external!(drop_intfloat))),
MapIntStr => Some(self.get(external!(drop_intstr))),
MapStrInt => Some(self.get(external!(drop_strint))),
MapStrFloat => Some(self.get(external!(drop_strfloat))),
MapStrStr => Some(self.get(external!(drop_strstr))),
_ => return None,
}
}
pub(crate) fn register(
&mut self,
name: &str,
cname: *const libc::c_char,
ty: LLVMTypeRef,
attrs: &[FunctionAttr],
func: *mut c_void,
) {
if let Some(old) = self.map.insert(
func as usize,
Intrinsic {
name: cname,
data: RefCell::new(Either::Left(ty)),
attrs: attrs.iter().cloned().collect(),
func,
},
) {
// Some functions that have distinct implementations may get merged in release builds
// (e.g. alloc_intint vs. alloc_intfloat). In that case it's fine to just overwrite
// the data. We still want this assert to run on debug builds, though, to guard against
// typos/duplicate registrations.
debug_assert!(
false,
"duplicate entry in intrinsics table for {} {:p}. Other entry: {}",
name,
func,
unsafe { String::from_utf8_lossy(std::ffi::CStr::from_ptr(old.name).to_bytes()) }
);
}
}
pub(crate) unsafe fn get(&self, func: *const u8) -> LLVMValueRef {
use llvm_sys::core::*;
let intr = &self.map[&(func as usize)];
let mut val = intr.data.borrow_mut();
let ty = match &mut *val {
Either::Left(ty) => *ty,
Either::Right(v) => return *v,
};
LLVMAddSymbol(intr.name, intr.func);
let func = LLVMAddFunction(self.module, intr.name, ty);
LLVMSetLinkage(func, llvm_sys::LLVMLinkage::LLVMExternalLinkage);
if intr.attrs.len() > 0 {
attr::add_function_attrs(self.ctx, func, &intr.attrs[..]);
}
*val = Either::Right(func);
func
}
}
|
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
#[macro_use] extern crate text_io;
struct Rect{
id: usize,
x: usize,
y: usize,
w: usize,
h: usize
}
fn solve(v: &[Rect]) {
let mut m = [[0;1000];1000];
for r in v {
for row in &mut m[r.y..r.y+r.h] {
for it in &mut row[r.x..r.x+r.w] {
*it += 1;
}
}
}
let r : usize = m.iter().map(|v|v.iter().filter(|&&x|x>1).count()).sum();
println!("{}",r);
'outer: for r in v {
for row in &m[r.y..r.y+r.h] {
for it in &row[r.x..r.x+r.w] {
if *it != 1 {
continue 'outer;
}
}
}
println!("{}",r.id);
}
}
fn main() {
let f = File::open("input").unwrap();
let f = BufReader::new(&f);
let v : Vec<_> = f.lines().map(|l|{
let l = l.unwrap();
let (id,x,y,w,h);
scan!(l.bytes() => "#{} @ {},{}: {}x{}", id,x,y,w,h);
Rect{id,x,y,w,h}
}).collect();
solve(&v);
}
|
fn largest_i32(list: &[i32]) -> i32{
let mut largest = list[0];
for &item in list.iter(){
if item > largest {
largest = item;
}
}
largest
}
fn largest_char(list: &[char]) -> char {
let mut largest = list[0];
for &item in list.iter(){
if item > largest {
largest = item;
}
}
largest
}
#[derive(Debug)]
struct Point<T, U> {
x: T,
// y: T // you can use a single T in the signature, or mix types is is shown
y: U,
}
// doesn't work yet
// fn largest<T>(list: &[T]) -> T {
// let mut largest = list[0];
// for &item in list.iter() {
// if item > largest {
// largest = item;
// }
// }
// largest
// }
fn main() {
let number_list = vec![34, 50, 25, 100, 65];
let result = largest_i32(&number_list);
println!("The largest number is {}", result);
let char_list = vec!['y', 'm', 'a', 'q'];
let result = largest_char(&char_list);
println!("The largest char is {}", result);
// let integer = Point{x: 4, y: 5};
// let float = Point{x: 4.1, y: 5.3};
let both_integer = Point { x: 5, y: 10 };
let both_float = Point { x: 1.0, y: 4.0 };
let integer_and_float = Point { x: 5, y: 4.0 };
} |
pub use self::ballsystem::BallSystem;
pub use self::paddlesystem::PaddleSystem;
pub use self::ballbouncesystem::BallBounceSystem;
mod ballsystem;
mod paddlesystem;
mod ballbouncesystem;
|
use core::alloc::Layout;
use core::ptr::NonNull;
use log::trace;
use liblumen_core::util::pointer::distance_absolute;
use crate::erts::exception::AllocResult;
use crate::erts::term::prelude::{Boxed, ProcBin, Term};
use super::alloc::{self, *};
use super::gc::{self, *};
use super::{Process, ProcessFlags};
/// This struct contains the actual semi-space heap that stack/heap allocations
/// are delegated to, and provides coordination for garbage collection of the
/// heap given the current process context.
#[derive(Debug)]
#[repr(C)]
pub struct ProcessHeap {
// the number of minor collections
pub(super) gen_gc_count: usize,
// The semi-space generational heap
heap: SemispaceProcessHeap,
}
impl ProcessHeap {
pub fn new(heap: *mut Term, heap_size: usize) -> Self {
let young = YoungHeap::new(heap, heap_size);
let old = OldHeap::default();
let heap = SemispaceHeap::new(young, old);
Self {
gen_gc_count: 0,
heap,
}
}
/// Returns true if this heap should be garbage collected
#[inline]
pub fn should_collect(&self, gc_threshold: f64) -> bool {
self.heap.should_collect(gc_threshold)
}
#[cfg(test)]
pub(super) fn heap(&self) -> &SemispaceProcessHeap {
&self.heap
}
/// Runs garbage collection against the current heap
///
/// This function and its helpers handle the following concerns:
///
/// - Calculating the size of the new heap
/// - Allocating a new heap
/// - Setting any necessary process flags
/// - Freeing dead heap fragments
/// - Tracking statistics
/// - Coordinating heap shrinkage/growth post-collection
///
/// In other words, most of the process-specific parts occur in
/// this module, while the more general garbage collection uses
/// the GC infrastructure defined elsewhere.
///
/// This separation makes it easier to test components of GC
/// independently, and provides opportunity to inject specific
/// components to test integrations of those components in isolation.
#[inline]
pub fn garbage_collect(
&mut self,
process: &Process,
needed: usize,
mut roots: RootSet,
) -> Result<usize, GcError> {
// The primary source of roots we add is the process stack
let young = self.heap.young_generation_mut();
let sp = young.stack_pointer();
let stack_size = young.stack_size();
roots.push_range(sp, stack_size);
// Initialize the collector
// Determine if the current collection requires a full sweep or not
if process.needs_fullsweep() || self.gen_gc_count >= process.max_gen_gcs {
self.collect_full(process, needed, roots)
} else {
self.collect_minor(process, needed, roots)
}
}
/// Handles the specific details required to initialize and execute a full sweep garbage
/// collection
fn collect_full(
&mut self,
process: &Process,
needed: usize,
roots: RootSet,
) -> Result<usize, GcError> {
trace!("Performing a full sweep garbage collection");
// Determine the estimated size for the new heap which will receive all live data
let old_heap_size = self.heap.old_generation().heap_used();
let young = self.heap.young_generation();
let off_heap_size = process.off_heap_size();
let size_before = young.heap_used() + old_heap_size + off_heap_size;
// Conservatively pad out estimated size to include space for the number of words `needed`
// free
let baseline_estimate = young.stack_used() + size_before;
let padded_estimate = baseline_estimate + needed;
// If we already have a large enough heap, we don't need to grow it, but if the GROW flag is
// set, then we should do it anyway, since it will prevent us from doing another full
// collection for awhile (assuming one is not forced)
let baseline_size = alloc::next_heap_size(padded_estimate);
let new_heap_size =
if baseline_size == young.heap_size() && process.should_force_heap_growth() {
alloc::next_heap_size(baseline_size)
} else {
baseline_size
};
// Verify that our projected heap size is not going to blow the max heap size, if set
// NOTE: When this happens, we will be left with no choice but to kill the process
if process.max_heap_size > 0 && process.max_heap_size < new_heap_size {
return Err(GcError::MaxHeapSizeExceeded);
}
// Unset heap_grow and need_fullsweep flags, because we are doing both
process
.flags
.clear(ProcessFlags::GrowHeap | ProcessFlags::NeedFullSweep);
// Allocate target heap (new young generation)
let ptr = alloc::heap(new_heap_size).map_err(|alloc| GcError::Alloc(alloc))?;
let mut target = YoungHeap::new(ptr, new_heap_size);
// Initialize collector
let _moved = {
let gc_type = FullCollection::new(&mut self.heap, &mut target);
let mut gc = ProcessCollector::new(roots, gc_type);
// Run the collector
gc.garbage_collect()?
};
// TODO: Move messages to be stored on-heap, on to the heap
// Now that all live data has been swept on to the new heap, we can
// clean up all of the off heap fragments that we still have laying around
process.sweep_off_heap();
// Reset the generational GC counter
self.gen_gc_count = 0;
// Calculate reclamation for tracing
let young = self.heap.young_generation();
let stack_used = young.stack_used();
let heap_used = young.heap_used();
let size_after = stack_used + heap_used + process.off_heap_size();
if size_before >= size_after {
trace!(
"Full sweep reclaimed {} words of garbage",
size_before - size_after
);
} else {
trace!(
"Full sweep resulted in heap growth of {} words",
size_after - size_before
);
}
// Determine if we oversized the heap and should shrink it
//
// This isn't strictly part of collection, but rather an
// operation we require to ensure that we catch pathological
// cases and handle them:
//
// - Unable to free enough space or allocate a large enough heap
// - We over-allocated by a significant margin, and need to shrink
// - We shrunk our heap usage, but not our heap, and need to shrink
// - We under-allocated by a significant margin, and need to grow
let needed_after = needed + stack_used + heap_used;
let total_size = young.heap_size();
// If this assertion fails, something went horribly wrong, our collection
// resulted in a heap that was smaller than even our worst case estimate,
// which means we almost certainly have a bug
assert!(
total_size >= needed_after,
"completed GC (full), but the heap size needed ({}) exceeds even the most pessimistic estimate ({}), this must be a bug!",
needed_after,
total_size,
);
// Check if the needed space consumes more than 75% of the new heap,
// and if so, schedule some heap growth to try and get ahead of allocations
// failing due to lack of space
if total_size * 3 < needed_after * 4 {
process.flags.set(ProcessFlags::GrowHeap);
return Ok(gc::estimate_cost(size_after, 0));
}
// Check if the needed space consumes less than 25% of the new heap,
// and if so, shrink the new heap immediately to free the unused space
if total_size > needed_after * 4 && process.min_heap_size < total_size {
// Shrink to double our estimated need
let mut estimate = needed_after * 2;
// If our estimated need is too low, round up to the min heap size;
// otherwise, calculate the next heap size bucket our need falls in
if estimate < process.min_heap_size {
estimate = process.min_heap_size;
} else {
estimate = alloc::next_heap_size(estimate);
}
// As a sanity check, only shrink the heap if the estimate is
// actually smaller than the current heap size
if estimate < total_size {
self.shrink_young_heap(estimate);
// The final cost of this GC needs to account for the moved heap
Ok(gc::estimate_cost(size_after, size_after))
} else {
// We're not actually going to shrink, so our
// cost is based purely on the size of the new heap
Ok(gc::estimate_cost(size_after, 0))
}
} else {
// No shrink required, so our cost is based purely on the size of the new heap
Ok(gc::estimate_cost(size_after, 0))
}
}
/// Handles the specific details required to initialize and execute a minor garbage collection
fn collect_minor(
&mut self,
process: &Process,
needed: usize,
roots: RootSet,
) -> Result<usize, GcError> {
trace!("Performing a minor garbage collection");
// Determine the estimated size for the new heap which will receive immature live data
let off_heap_size = process.off_heap_size();
let young = self.heap.young_generation();
let size_before = young.heap_used() + off_heap_size;
let stack_size = young.stack_used();
// Calculate mature region
let mature_size = young.mature_size();
// Verify that our projected heap size does not exceed
// the max heap size, if one was configured.
//
// If a max heap size is set, make sure we're not going to exceed it
if process.max_heap_size > 0 {
// First, check if we have exceeded the max heap size
let mut heap_size = size_before;
// In this estimate, our stack size includes unused area between stack and heap
let stack_size = stack_size + young.heap_available();
let old = self.heap.old_generation();
// Add potential old heap size
if !old.active() && mature_size > 0 {
heap_size += alloc::next_heap_size(size_before);
} else if old.active() {
heap_size += old.heap_used();
}
// Add potential new young heap size, conservatively estimating
// the worst case scenario where we free no memory and need to
// reclaim `needed` words. We grow the projected size until there
// is at least enough memory for the current heap + `needed`
let baseline_size = stack_size + size_before + needed;
heap_size += alloc::next_heap_size(baseline_size);
// When this error type is returned, a full sweep will be triggered
if heap_size > process.max_heap_size {
return Err(GcError::MaxHeapSizeExceeded);
}
}
// Allocate an old heap if we don't have one and one is needed
if !self.heap.old_generation().active() && mature_size > 0 {
let size = alloc::next_heap_size(size_before);
let ptr = alloc::heap(size).map_err(|alloc| GcError::Alloc(alloc))?;
let _ = self.heap.swap_old(OldHeap::new(ptr, size));
}
// If the old heap isn't present, or isn't large enough to hold the
// mature objects in the young generation, then a full sweep is required
let old = self.heap.old_generation();
if old.active() && mature_size > old.heap_available() {
return Err(GcError::FullsweepRequired);
}
let prev_old_top = old.heap_top();
let baseline_size = stack_size + size_before + needed;
// While we expect that we will free memory during collection,
// we want to avoid the case where we collect and then find that
// the new heap is too small to meet the need that triggered the
// collection in the first place. Better to shrink it post-collection
// than to require growing it and re-updating all the roots again
let new_size = alloc::next_heap_size(baseline_size);
// Allocate new young generation heap
let ptr = alloc::heap(new_size).map_err(|alloc| GcError::Alloc(alloc))?;
let new_young = YoungHeap::new(ptr, new_size);
// Swap it with the existing young generation heap
let mut source = self.heap.swap_young(new_young);
let _moved = {
// Initialize the collector to collect objects into the new semi-space heap
let gc_type = MinorCollection::new(&mut source, &mut self.heap);
let mut gc = ProcessCollector::new(roots, gc_type);
// Run the collector
gc.garbage_collect()?
};
// Now that all live data has been swept on to the new heap, we can
// clean up all of the off heap fragments that we still have laying around
process.sweep_off_heap();
// Increment the generational GC counter
self.gen_gc_count += 1;
// TODO: if using on-heap messages, move messages in the queue to the heap
// Calculate memory usage after collection
let old = self.heap.old_generation();
let young = self.heap.young_generation();
let new_mature_size = distance_absolute(old.heap_top(), prev_old_top);
let heap_used = young.heap_used();
let size_after = new_mature_size + heap_used; // TODO: add process.mbuf_size
let needed_after = heap_used + needed + stack_size;
// Excessively large heaps should be shrunk, but don't even bother on reasonable small heaps
//
// The reason for this is that after tenuring, we often use a really small portion of the
// new heap, therefore unless the heap size is substantial, we don't want to shrink
let heap_size = young.heap_size();
let is_oversized = heap_size > needed_after * 4;
let old_heap_size = old.heap_size();
let should_shrink = is_oversized && (heap_size > 8000 || heap_size > old_heap_size);
if should_shrink {
// We are going to shrink the heap to 3x the size of our current need,
// at this point we already know that the heap is more than 4x our current need,
// so this provides a reasonable baseline heap usage of 33%
let mut estimate = needed_after * 3;
// However, if this estimate is very small compared to the size of
// the old generation, then we are likely going to be forced to reallocate
// sooner rather than later, as the old generation would seem to indicate
// that we allocate many objects.
//
// We determine our estimate to be too small if it is less than 10% the
// size of the old generation. In this situation, we set our estimate to
// be 25% of the old generation heap size
if estimate * 9 < old_heap_size {
estimate = old_heap_size / 8;
}
// If the new estimate is less than the min heap size, then round up;
// otherwise, round the estimate up to the nearest heap size bucket
if estimate < process.min_heap_size {
estimate = process.min_heap_size;
} else {
estimate = alloc::next_heap_size(estimate);
}
// As a sanity check, only shrink if our revised estimate is
// actually smaller than the current heap size
if estimate < heap_size {
self.shrink_young_heap(estimate);
// Our final cost should account for the moved heap
Ok(gc::estimate_cost(size_after, heap_used))
} else {
// We're not actually going to shrink, so our cost
// is entirely based on the size of the new heap
Ok(gc::estimate_cost(size_after, 0))
}
} else {
// No shrink required, so our cost is based
// on the size of the new heap only
Ok(gc::estimate_cost(size_after, 0))
}
}
/// In some cases, after a minor collection we may find that we have over-allocated for the
/// new young heap, this is because we make a conservative estimate as to how much space will
/// be needed, and if our collections are effective, that may leave a lot of unused space.
///
/// We only really care about excessively large heaps, as reasonable heap sizes, even if
/// larger than needed, are not worth the effort to shrink. In the case of the exessively
/// large heaps though, we need to shift the stack from the end of the heap to its new
/// position, and then reallocate (in place) the memory underlying the heap.
///
/// Since we control the allocator for process heaps, it is not necessary for us to handle
/// the case of trying to reallocate the heap and having it move on us, beyond asserting
/// that the heap is not moved. In BEAM, they have to account for that condition, as the
/// allocators do not provide a `realloc_in_place` API
fn shrink_young_heap(&mut self, new_size: usize) {
unsafe { self.heap.young_generation_mut().shrink(new_size) }
}
}
impl HeapAlloc for ProcessHeap {
#[inline]
unsafe fn alloc_layout(&mut self, layout: Layout) -> AllocResult<NonNull<Term>> {
self.heap.alloc_layout(layout)
}
}
impl Heap for ProcessHeap {
fn is_corrupted(&self) -> bool {
self.heap.is_corrupted()
}
#[inline]
fn heap_start(&self) -> *mut Term {
self.heap.heap_start()
}
#[inline]
fn heap_top(&self) -> *mut Term {
self.heap.heap_top()
}
#[inline]
fn heap_end(&self) -> *mut Term {
self.heap.heap_end()
}
#[inline]
fn heap_size(&self) -> usize {
self.heap.heap_size()
}
#[inline]
fn heap_used(&self) -> usize {
self.heap.heap_used()
}
#[inline]
fn heap_available(&self) -> usize {
self.heap.heap_available()
}
#[inline]
fn contains<T: ?Sized>(&self, ptr: *const T) -> bool {
self.heap.contains(ptr)
}
#[inline]
fn is_owner<T: ?Sized>(&self, ptr: *const T) -> bool {
self.heap.contains(ptr)
}
}
impl VirtualHeap<ProcBin> for ProcessHeap {
#[inline]
fn virtual_size(&self) -> usize {
self.heap.virtual_size()
}
#[inline]
fn virtual_heap_used(&self) -> usize {
self.heap.virtual_heap_used()
}
#[inline]
fn virtual_heap_unused(&self) -> usize {
self.heap.virtual_heap_unused()
}
}
impl VirtualAllocator<ProcBin> for ProcessHeap {
#[inline]
fn virtual_alloc(&mut self, value: Boxed<ProcBin>) {
self.heap.virtual_alloc(value)
}
#[inline]
fn virtual_free(&mut self, value: Boxed<ProcBin>) {
self.heap.virtual_free(value);
}
#[inline]
fn virtual_unlink(&mut self, value: Boxed<ProcBin>) {
self.heap.virtual_unlink(value);
}
#[inline]
fn virtual_pop(&mut self, value: Boxed<ProcBin>) -> ProcBin {
self.heap.virtual_pop(value)
}
#[inline]
fn virtual_contains<P: ?Sized>(&self, value: *const P) -> bool {
self.heap.virtual_contains(value)
}
#[inline]
unsafe fn virtual_clear(&mut self) {
self.heap.virtual_clear();
}
}
impl StackAlloc for ProcessHeap {
#[inline]
unsafe fn alloca(&mut self, need: usize) -> AllocResult<NonNull<Term>> {
self.heap.alloca(need)
}
#[inline]
unsafe fn alloca_unchecked(&mut self, need: usize) -> NonNull<Term> {
self.heap.alloca_unchecked(need)
}
}
impl StackPrimitives for ProcessHeap {
#[inline]
fn stack_size(&self) -> usize {
self.heap.stack_size()
}
#[inline]
unsafe fn set_stack_size(&mut self, size: usize) {
self.heap.set_stack_size(size);
}
#[inline]
fn stack_pointer(&mut self) -> *mut Term {
self.heap.stack_pointer()
}
#[inline]
unsafe fn set_stack_pointer(&mut self, sp: *mut Term) {
self.heap.set_stack_pointer(sp);
}
#[inline]
fn stack_used(&self) -> usize {
self.heap.stack_used()
}
#[inline]
fn stack_available(&self) -> usize {
self.heap.stack_available()
}
#[inline]
fn stack_slot(&mut self, n: usize) -> Option<Term> {
self.heap.stack_slot(n)
}
#[inline]
fn stack_popn(&mut self, n: usize) {
self.heap.stack_popn(n);
}
}
|
pub struct Solution;
use std::collections::HashMap;
impl Solution {
pub fn largest_divisible_subset(nums: Vec<i32>) -> Vec<i32> {
Solver::default().solve(nums)
}
}
#[derive(Default)]
struct Solver {
ranks: Vec<Vec<i32>>,
prev: HashMap<i32, i32>,
}
impl Solver {
fn solve(mut self, mut nums: Vec<i32>) -> Vec<i32> {
nums.sort();
for num in nums {
self.add(num);
}
let mut res = Vec::new();
if let Some(mut n) = self.ranks.last().map(|v| v[0]) {
loop {
res.push(n);
if let Some(&m) = self.prev.get(&n) {
n = m;
} else {
break;
}
}
}
res
}
fn add(&mut self, n: i32) {
for i in (0..self.ranks.len()).rev() {
for j in 0..self.ranks[i].len() {
if 2 * self.ranks[i][j] > n {
break;
}
if n % self.ranks[i][j] == 0 {
if self.ranks.len() == i + 1 {
self.ranks.push(Vec::new());
}
self.ranks[i + 1].push(n);
self.prev.insert(n, self.ranks[i][j]);
return;
}
}
}
if self.ranks.len() == 0 {
self.ranks.push(Vec::new());
}
self.ranks[0].push(n);
}
}
#[test]
fn test0368() {
fn case(nums: Vec<i32>, want: Vec<i32>) {
let mut got = Solution::largest_divisible_subset(nums);
got.sort();
assert_eq!(got, want);
}
case(vec![1, 2, 3], vec![1, 2]);
case(vec![1, 2, 4, 8], vec![1, 2, 4, 8]);
case(vec![], vec![]);
case(vec![2, 3, 9], vec![3, 9]);
}
|
#[doc = "Reader of register ATCR1"]
pub type R = crate::R<u32, super::ATCR1>;
#[doc = "Writer for register ATCR1"]
pub type W = crate::W<u32, super::ATCR1>;
#[doc = "Register ATCR1 `reset()`'s with value 0x0007_0000"]
impl crate::ResetValue for super::ATCR1 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0x0007_0000
}
}
#[doc = "Reader of field `TAMP1AM`"]
pub type TAMP1AM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TAMP1AM`"]
pub struct TAMP1AM_W<'a> {
w: &'a mut W,
}
impl<'a> TAMP1AM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
self.w
}
}
#[doc = "Reader of field `TAMP2AM`"]
pub type TAMP2AM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TAMP2AM`"]
pub struct TAMP2AM_W<'a> {
w: &'a mut W,
}
impl<'a> TAMP2AM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
self.w
}
}
#[doc = "Reader of field `TAMP3AM`"]
pub type TAMP3AM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TAMP3AM`"]
pub struct TAMP3AM_W<'a> {
w: &'a mut W,
}
impl<'a> TAMP3AM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
self.w
}
}
#[doc = "Reader of field `TAMP4AM`"]
pub type TAMP4AM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TAMP4AM`"]
pub struct TAMP4AM_W<'a> {
w: &'a mut W,
}
impl<'a> TAMP4AM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
self.w
}
}
#[doc = "Reader of field `TAMP5AM`"]
pub type TAMP5AM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TAMP5AM`"]
pub struct TAMP5AM_W<'a> {
w: &'a mut W,
}
impl<'a> TAMP5AM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
self.w
}
}
#[doc = "Reader of field `TAMP6AM`"]
pub type TAMP6AM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TAMP6AM`"]
pub struct TAMP6AM_W<'a> {
w: &'a mut W,
}
impl<'a> TAMP6AM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
self.w
}
}
#[doc = "Reader of field `TAMP7AM`"]
pub type TAMP7AM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TAMP7AM`"]
pub struct TAMP7AM_W<'a> {
w: &'a mut W,
}
impl<'a> TAMP7AM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
self.w
}
}
#[doc = "Reader of field `TAMP8AM`"]
pub type TAMP8AM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TAMP8AM`"]
pub struct TAMP8AM_W<'a> {
w: &'a mut W,
}
impl<'a> TAMP8AM_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
self.w
}
}
#[doc = "Reader of field `ATOSEL1`"]
pub type ATOSEL1_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `ATOSEL1`"]
pub struct ATOSEL1_W<'a> {
w: &'a mut W,
}
impl<'a> ATOSEL1_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
self.w
}
}
#[doc = "Reader of field `ATOSEL2`"]
pub type ATOSEL2_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `ATOSEL2`"]
pub struct ATOSEL2_W<'a> {
w: &'a mut W,
}
impl<'a> ATOSEL2_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
self.w
}
}
#[doc = "Reader of field `ATOSEL3`"]
pub type ATOSEL3_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `ATOSEL3`"]
pub struct ATOSEL3_W<'a> {
w: &'a mut W,
}
impl<'a> ATOSEL3_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u32) & 0x03) << 12);
self.w
}
}
#[doc = "Reader of field `ATOSEL4`"]
pub type ATOSEL4_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `ATOSEL4`"]
pub struct ATOSEL4_W<'a> {
w: &'a mut W,
}
impl<'a> ATOSEL4_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 14)) | (((value as u32) & 0x03) << 14);
self.w
}
}
#[doc = "Reader of field `ATCKSEL`"]
pub type ATCKSEL_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `ATCKSEL`"]
pub struct ATCKSEL_W<'a> {
w: &'a mut W,
}
impl<'a> ATCKSEL_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
self.w
}
}
#[doc = "Reader of field `ATPER`"]
pub type ATPER_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `ATPER`"]
pub struct ATPER_W<'a> {
w: &'a mut W,
}
impl<'a> ATPER_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 24)) | (((value as u32) & 0x03) << 24);
self.w
}
}
#[doc = "Reader of field `ATOSHARE`"]
pub type ATOSHARE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `ATOSHARE`"]
pub struct ATOSHARE_W<'a> {
w: &'a mut W,
}
impl<'a> ATOSHARE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
self.w
}
}
#[doc = "Reader of field `FLTEN`"]
pub type FLTEN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `FLTEN`"]
pub struct FLTEN_W<'a> {
w: &'a mut W,
}
impl<'a> FLTEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
self.w
}
}
impl R {
#[doc = "Bit 0 - TAMP1AM"]
#[inline(always)]
pub fn tamp1am(&self) -> TAMP1AM_R {
TAMP1AM_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - TAMP2AM"]
#[inline(always)]
pub fn tamp2am(&self) -> TAMP2AM_R {
TAMP2AM_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - TAMP3AM"]
#[inline(always)]
pub fn tamp3am(&self) -> TAMP3AM_R {
TAMP3AM_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - TAMP4AM"]
#[inline(always)]
pub fn tamp4am(&self) -> TAMP4AM_R {
TAMP4AM_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - TAMP5AM"]
#[inline(always)]
pub fn tamp5am(&self) -> TAMP5AM_R {
TAMP5AM_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - TAMP6AM"]
#[inline(always)]
pub fn tamp6am(&self) -> TAMP6AM_R {
TAMP6AM_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - TAMP7AM"]
#[inline(always)]
pub fn tamp7am(&self) -> TAMP7AM_R {
TAMP7AM_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 7 - TAMP8AM"]
#[inline(always)]
pub fn tamp8am(&self) -> TAMP8AM_R {
TAMP8AM_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bits 8:9 - ATOSEL1"]
#[inline(always)]
pub fn atosel1(&self) -> ATOSEL1_R {
ATOSEL1_R::new(((self.bits >> 8) & 0x03) as u8)
}
#[doc = "Bits 10:11 - ATOSEL2"]
#[inline(always)]
pub fn atosel2(&self) -> ATOSEL2_R {
ATOSEL2_R::new(((self.bits >> 10) & 0x03) as u8)
}
#[doc = "Bits 12:13 - ATOSEL3"]
#[inline(always)]
pub fn atosel3(&self) -> ATOSEL3_R {
ATOSEL3_R::new(((self.bits >> 12) & 0x03) as u8)
}
#[doc = "Bits 14:15 - ATOSEL4"]
#[inline(always)]
pub fn atosel4(&self) -> ATOSEL4_R {
ATOSEL4_R::new(((self.bits >> 14) & 0x03) as u8)
}
#[doc = "Bits 16:17 - ATCKSEL"]
#[inline(always)]
pub fn atcksel(&self) -> ATCKSEL_R {
ATCKSEL_R::new(((self.bits >> 16) & 0x03) as u8)
}
#[doc = "Bits 24:25 - ATPER"]
#[inline(always)]
pub fn atper(&self) -> ATPER_R {
ATPER_R::new(((self.bits >> 24) & 0x03) as u8)
}
#[doc = "Bit 30 - ATOSHARE"]
#[inline(always)]
pub fn atoshare(&self) -> ATOSHARE_R {
ATOSHARE_R::new(((self.bits >> 30) & 0x01) != 0)
}
#[doc = "Bit 31 - FLTEN"]
#[inline(always)]
pub fn flten(&self) -> FLTEN_R {
FLTEN_R::new(((self.bits >> 31) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - TAMP1AM"]
#[inline(always)]
pub fn tamp1am(&mut self) -> TAMP1AM_W {
TAMP1AM_W { w: self }
}
#[doc = "Bit 1 - TAMP2AM"]
#[inline(always)]
pub fn tamp2am(&mut self) -> TAMP2AM_W {
TAMP2AM_W { w: self }
}
#[doc = "Bit 2 - TAMP3AM"]
#[inline(always)]
pub fn tamp3am(&mut self) -> TAMP3AM_W {
TAMP3AM_W { w: self }
}
#[doc = "Bit 3 - TAMP4AM"]
#[inline(always)]
pub fn tamp4am(&mut self) -> TAMP4AM_W {
TAMP4AM_W { w: self }
}
#[doc = "Bit 4 - TAMP5AM"]
#[inline(always)]
pub fn tamp5am(&mut self) -> TAMP5AM_W {
TAMP5AM_W { w: self }
}
#[doc = "Bit 5 - TAMP6AM"]
#[inline(always)]
pub fn tamp6am(&mut self) -> TAMP6AM_W {
TAMP6AM_W { w: self }
}
#[doc = "Bit 6 - TAMP7AM"]
#[inline(always)]
pub fn tamp7am(&mut self) -> TAMP7AM_W {
TAMP7AM_W { w: self }
}
#[doc = "Bit 7 - TAMP8AM"]
#[inline(always)]
pub fn tamp8am(&mut self) -> TAMP8AM_W {
TAMP8AM_W { w: self }
}
#[doc = "Bits 8:9 - ATOSEL1"]
#[inline(always)]
pub fn atosel1(&mut self) -> ATOSEL1_W {
ATOSEL1_W { w: self }
}
#[doc = "Bits 10:11 - ATOSEL2"]
#[inline(always)]
pub fn atosel2(&mut self) -> ATOSEL2_W {
ATOSEL2_W { w: self }
}
#[doc = "Bits 12:13 - ATOSEL3"]
#[inline(always)]
pub fn atosel3(&mut self) -> ATOSEL3_W {
ATOSEL3_W { w: self }
}
#[doc = "Bits 14:15 - ATOSEL4"]
#[inline(always)]
pub fn atosel4(&mut self) -> ATOSEL4_W {
ATOSEL4_W { w: self }
}
#[doc = "Bits 16:17 - ATCKSEL"]
#[inline(always)]
pub fn atcksel(&mut self) -> ATCKSEL_W {
ATCKSEL_W { w: self }
}
#[doc = "Bits 24:25 - ATPER"]
#[inline(always)]
pub fn atper(&mut self) -> ATPER_W {
ATPER_W { w: self }
}
#[doc = "Bit 30 - ATOSHARE"]
#[inline(always)]
pub fn atoshare(&mut self) -> ATOSHARE_W {
ATOSHARE_W { w: self }
}
#[doc = "Bit 31 - FLTEN"]
#[inline(always)]
pub fn flten(&mut self) -> FLTEN_W {
FLTEN_W { w: self }
}
}
|
use itertools::Itertools;
use whiteread::parse_line;
fn main() {
let mut mods200: Vec<Vec<u64>> = vec![vec![]; 200];
let n: u64 = whiteread::parse_line().unwrap();
let aa: Vec<u64> = whiteread::parse_line().unwrap();
for a in aa {
mods200[(a % 200) as usize].push(a);
}
let mut count = 0;
for m in mods200 {
let n = m.len() as u128;
if n < 2 {
continue;
}
count += (n * (n - 1)) / 2;
}
println!("{}", count);
}
|
use crate::{drawing::JsDrawing, graph::JsGraph};
use petgraph_algorithm_shortest_path::warshall_floyd;
use petgraph_quality_metrics::{crossing_number, neighborhood_preservation, stress};
use wasm_bindgen::prelude::*;
#[wasm_bindgen(js_name = stress)]
pub fn js_stress(graph: &JsGraph, drawing: &JsDrawing) -> f32 {
let distance = warshall_floyd(graph.graph(), &mut |_| 1.0);
stress(drawing.drawing(), &distance)
}
#[wasm_bindgen(js_name = crossingNumber)]
pub fn js_crossing_number(graph: &JsGraph, drawing: &JsDrawing) -> f32 {
crossing_number(graph.graph(), drawing.drawing())
}
#[wasm_bindgen(js_name = neighborhoodPreservation)]
pub fn js_neighborhood_preservation(graph: &JsGraph, drawing: &JsDrawing) -> f32 {
neighborhood_preservation(graph.graph(), drawing.drawing())
}
|
use crate::material::Material;
use crate::math::*;
use crate::{HitRecord, Ray};
use nalgebra::Unit;
use rand::RngCore;
use rand_distr::{Distribution, Uniform};
use std::sync::Arc;
use std::f64::consts::{PI, TAU};
pub trait Hittable: Sync + Send {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord>;
fn bounding_box(&self, t0: f64, t1: f64) -> Option<AABB>;
}
// - Transform -
pub struct Transform {
transform: Mat4,
inv_transform: Mat4,
normal_mat: Mat4,
inv_normal: Mat4,
child: Arc<dyn Hittable>,
bbox: Option<AABB>,
}
impl Transform {
pub fn new(transform: &Mat4, child: Arc<dyn Hittable>) -> Transform {
let bbox = Transform::get_transformed_bbox(0., 1., transform, &child);
let mut rot_only = transform.clone();
rot_only[(0, 3)] = 0.;
rot_only[(1, 3)] = 0.;
rot_only[(2, 3)] = 0.;
rot_only[(3, 3)] = 1.;
Transform {
transform: transform.clone(),
inv_transform: transform.try_inverse().unwrap(),
normal_mat: rot_only,
inv_normal: rot_only.try_inverse().unwrap(),
child,
bbox,
}
}
fn get_transformed_bbox(
t0: f64,
t1: f64,
transform: &Mat4,
child: &Arc<dyn Hittable>,
) -> Option<AABB> {
let bbox = child.bounding_box(t0, t1);
if let None = bbox {
return None;
}
let bbox = bbox.unwrap();
let mut vmin = Vec3::from_element(f64::INFINITY);
let mut vmax = Vec3::from_element(f64::NEG_INFINITY);
for i in 0..2 {
for j in 0..2 {
for k in 0..2 {
let i = i as f64;
let j = j as f64;
let k = k as f64;
let x = i * bbox.max.x + (1. - i) * bbox.min.x;
let y = j * bbox.max.y + (1. - j) * bbox.min.y;
let z = k * bbox.max.z + (1. - k) * bbox.min.z;
let new_vec = (transform * Vec4::new(x, y, z, 1.)).xyz();
vmin = vmin.zip_map(&new_vec, f64::min);
vmax = vmax.zip_map(&new_vec, f64::max);
}
}
}
Some(AABB::new(vmin, vmax))
}
pub fn from_rot_x(angle: f64, child: Arc<dyn Hittable>) -> Transform {
let axis = Unit::new_normalize(Vec3::new(1., 0., 0.));
Transform::new(&Mat4::from_axis_angle(&axis, angle), child)
}
pub fn from_rot_y(angle: f64, child: Arc<dyn Hittable>) -> Transform {
let axis = Unit::new_normalize(Vec3::new(0., 1., 0.));
Transform::new(&Mat4::from_axis_angle(&axis, angle), child)
}
pub fn from_rot_z(angle: f64, child: Arc<dyn Hittable>) -> Transform {
let axis = Unit::new_normalize(Vec3::new(0., 0., 1.));
Transform::new(&Mat4::from_axis_angle(&axis, angle), child)
}
}
impl Hittable for Transform {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
let origin = Vec4::new(ray.origin.x, ray.origin.y, ray.origin.z, 1.);
let dir = Vec4::new(ray.direction.x, ray.direction.y, ray.direction.z, 1.);
let inverse_origin = self.inv_transform * origin;
let inverse_dir = self.inv_normal * dir;
let record = self.child.hit(
&Ray {
origin: inverse_origin.xyz(),
direction: inverse_dir.xyz(),
time: ray.time,
},
t_min,
t_max,
);
if record.is_none() {
return None;
}
let record = record.unwrap();
let p = Vec4::new(record.p.x, record.p.y, record.p.z, 1.);
let p = self.transform * p;
let normal = Vec4::new(record.normal.x, record.normal.y, record.normal.z, 1.);
let normal = self.normal_mat * normal;
Some(HitRecord {
front_facing: record.front_facing,
material: record.material,
normal: normal.xyz().normalize(),
t: record.t,
p: p.xyz(),
u: record.u,
v: record.v,
})
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
self.bbox.clone()
}
}
// - Sphere -
pub struct Sphere {
pub center: Vec3,
pub radius: f64,
pub material: Arc<dyn Material>,
}
impl Sphere {
pub fn get_uv(p: &Vec3) -> (f64, f64) {
let theta = (-p.y).acos();
let phi = f64::atan2(-p.z, p.x) + std::f64::consts::PI;
(phi / TAU, theta / PI)
}
}
impl Hittable for Sphere {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
match ray_sphere_intersection(&self.center, self.radius, &ray, t_min, t_max) {
Some((root, point, normal)) => {
let (u, v) = Sphere::get_uv(&normal);
Some(HitRecord::from_uv(
root,
point,
ray.direction,
normal,
self.material.as_ref(),
u,
v,
))
}
None => None,
}
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
let radius_vector = Vec3::from_element(self.radius);
Some(AABB::new(
self.center - radius_vector,
self.center + radius_vector,
))
}
}
pub struct MovingSphere {
pub center_begin: Vec3,
pub center_end: Vec3,
pub time_begin: f64,
pub time_end: f64,
pub radius: f64,
pub material: Arc<dyn Material>,
}
impl MovingSphere {
fn center_at(&self, t: f64) -> Vec3 {
let ratio = (t - self.time_begin) / (self.time_end - self.time_begin);
self.center_begin.lerp(&self.center_end, ratio)
}
}
impl Hittable for MovingSphere {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
let center_at_time = self.center_at(ray.time);
match ray_sphere_intersection(¢er_at_time, self.radius, &ray, t_min, t_max) {
Some((root, point, normal)) => Some(HitRecord::from(
root,
point,
ray.direction,
normal,
self.material.as_ref(),
)),
None => None,
}
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
let radius_vector = Vec3::from_element(self.radius);
let box_at_begin = AABB::new(
self.center_begin - radius_vector,
self.center_begin + radius_vector,
);
let box_at_end = AABB::new(
self.center_end - radius_vector,
self.center_end + radius_vector,
);
Some(AABB::union(&box_at_begin, &box_at_end))
}
}
fn ray_sphere_intersection(
center: &Vec3,
radius: f64,
ray: &Ray,
t_min: f64,
t_max: f64,
) -> Option<(f64, Vec3, Vec3)> {
let oc = ray.origin - center;
let a = ray.direction.norm_squared();
let half_b = oc.dot(&ray.direction);
let c = oc.norm_squared() - radius.powi(2);
let discriminant = a.mul_add(-c, half_b.powi(2));
if discriminant < 0.0 {
return None;
}
let sqrtd = discriminant.sqrt();
let mut root = (-half_b - sqrtd) / a;
if root < t_min || root > t_max {
root = (-half_b + sqrtd) / a;
if root < t_min || root > t_max {
return None;
}
}
let new_point = ray.at(root);
let outward_normal = (new_point - center) / radius;
Some((root, new_point, outward_normal))
}
// - Planes --
pub struct XyPlane {
pub min: Vec2,
pub max: Vec2,
pub k: f64,
pub material: Arc<dyn Material>,
}
impl Hittable for XyPlane {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
let t = (self.k - ray.origin.z) / ray.direction.z;
if t < t_min || t > t_max {
return None;
}
let x = ray.origin.x + t * ray.direction.x;
let y = ray.origin.y + t * ray.direction.y;
if x < self.min.x || x > self.max.x || y < self.min.y || y > self.max.y {
return None;
}
let u = (x - self.min.x) / (self.max.x - self.min.x);
let v = (y - self.min.y) / (self.max.y - self.min.y);
Some(HitRecord::from_uv(
t,
ray.at(t),
ray.direction,
Vec3::new(0., 0., 1.),
self.material.as_ref(),
u,
v,
))
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
Some(AABB {
min: Vec3::new(self.min.x, self.min.y, self.k - 1e-4),
max: Vec3::new(self.max.x, self.max.y, self.k + 1e-4),
})
}
}
pub struct XzPlane {
pub min: Vec2,
pub max: Vec2,
pub k: f64,
pub material: Arc<dyn Material>,
}
impl Hittable for XzPlane {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
let t = (self.k - ray.origin.y) / ray.direction.y;
if t < t_min || t > t_max {
return None;
}
let x = ray.origin.x + t * ray.direction.x;
let z = ray.origin.z + t * ray.direction.z;
if x < self.min.x || x > self.max.x || z < self.min.y || z > self.max.y {
return None;
}
let u = (x - self.min.x) / (self.max.x - self.min.x);
let v = (z - self.min.y) / (self.max.y - self.min.y);
Some(HitRecord::from_uv(
t,
ray.at(t),
ray.direction,
Vec3::new(0., 1., 0.),
self.material.as_ref(),
u,
v,
))
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
Some(AABB {
min: Vec3::new(self.min.x, self.k - 1e-4, self.min.y),
max: Vec3::new(self.max.x, self.k + 1e-4, self.max.y),
})
}
}
pub struct YzPlane {
pub min: Vec2,
pub max: Vec2,
pub k: f64,
pub material: Arc<dyn Material>,
}
impl Hittable for YzPlane {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
let t = (self.k - ray.origin.x) / ray.direction.x;
if t < t_min || t > t_max {
return None;
}
let y = ray.origin.y + t * ray.direction.y;
let z = ray.origin.z + t * ray.direction.z;
if y < self.min.x || y > self.max.x || z < self.min.y || z > self.max.y {
return None;
}
let u = (y - self.min.x) / (self.max.x - self.min.x);
let v = (z - self.min.y) / (self.max.y - self.min.y);
Some(HitRecord::from_uv(
t,
ray.at(t),
ray.direction,
Vec3::new(1., 0., 0.),
self.material.as_ref(),
u,
v,
))
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
Some(AABB {
min: Vec3::new(self.k - 1e-4, self.min.x, self.min.y),
max: Vec3::new(self.k + 1e-4, self.max.x, self.max.y),
})
}
}
// - Box -
// Sigint: A cardboard box? Why are you...?
// Renamed to Cube because Box is already a thing in Rust
pub struct Cube {
sides: HittableList,
bbox: AABB,
}
impl Cube {
pub fn new(min: Vec3, max: Vec3, material: Arc<dyn Material>, rng: &mut impl RngCore) -> Cube {
let mut side_vec: Vec<Arc<dyn Hittable>> = vec![];
side_vec.push(Arc::new(XyPlane {
min: min.xy(),
max: max.xy(),
k: min.z,
material: material.clone(),
}));
side_vec.push(Arc::new(XyPlane {
min: min.xy(),
max: max.xy(),
k: max.z,
material: material.clone(),
}));
side_vec.push(Arc::new(XzPlane {
min: min.xz(),
max: max.xz(),
k: min.y,
material: material.clone(),
}));
side_vec.push(Arc::new(XzPlane {
min: min.xz(),
max: max.xz(),
k: max.y,
material: material.clone(),
}));
side_vec.push(Arc::new(YzPlane {
min: min.yz(),
max: max.yz(),
k: min.x,
material: material.clone(),
}));
side_vec.push(Arc::new(YzPlane {
min: min.yz(),
max: max.yz(),
k: max.x,
material: material.clone(),
}));
Cube {
sides: HittableList::from_slice(&side_vec, 0., 1., rng),
bbox: AABB::new(min, max),
}
}
}
impl Hittable for Cube {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
self.sides.hit(ray, t_min, t_max)
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
Some(self.bbox.clone())
}
}
// - Container structures -
pub struct BvhNode {
left: Arc<dyn Hittable>,
right: Arc<dyn Hittable>,
node_box: AABB,
}
impl BvhNode {
pub fn from_slice(
data: &[Arc<dyn Hittable>],
t0: f64,
t1: f64,
rng: &mut impl RngCore,
) -> BvhNode {
let span = data.len();
let mut copy = Vec::new();
match span {
1 => BvhNode {
left: data[0].clone(),
right: data[0].clone(),
node_box: data[0]
.as_ref()
.bounding_box(t0, t1)
.unwrap_or(AABB::zeros()),
},
2 => {
let left = data[0].as_ref();
let right = data[1].as_ref();
let box_left = left.bounding_box(t0, t1).unwrap_or(AABB::zeros());
let box_right = right.bounding_box(t0, t1).unwrap_or(AABB::zeros());
BvhNode {
left: data[0].clone(),
right: data[1].clone(),
node_box: AABB::union(&box_left, &box_right),
}
}
_ => {
for hittable in data {
let hittable = Arc::clone(&hittable);
copy.push(hittable);
}
copy.sort_by(|left, right| {
BvhNode::box_compare(
left.as_ref(),
right.as_ref(),
Uniform::from(0..3).sample(rng),
)
});
let mid = span / 2;
let (left, right) = copy.split_at(mid);
let left = BvhNode::from_slice(left, t0, t1, rng);
let right = BvhNode::from_slice(right, t0, t1, rng);
let box_left = left.bounding_box(t0, t1).unwrap_or(AABB::zeros());
let box_right = right.bounding_box(t0, t1).unwrap_or(AABB::zeros());
BvhNode {
left: Arc::new(left),
right: Arc::new(right),
node_box: AABB::union(&box_left, &box_right),
}
}
}
}
fn box_compare(a: &dyn Hittable, b: &dyn Hittable, axis: u8) -> std::cmp::Ordering {
let box_a = a.bounding_box(0.0, 0.0);
let box_b = b.bounding_box(0.0, 0.0);
if box_a.is_none() || box_b.is_none() {
eprintln!("No bbox in BvhNode constructor");
}
let box_a = box_a.unwrap_or(AABB::zeros());
let box_b = box_b.unwrap_or(AABB::zeros());
match axis {
0 => box_a.min.x.partial_cmp(&box_b.min.x).unwrap(),
1 => box_a.min.y.partial_cmp(&box_b.min.y).unwrap(),
2 => box_a.min.z.partial_cmp(&box_b.min.z).unwrap(),
_ => panic!("Unreachable"),
}
}
}
impl Hittable for BvhNode {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
if !self.node_box.intersects(&ray, t_min, t_max) {
return None;
}
if let Some(hit_left) = self.left.as_ref().hit(&ray, t_min, t_max) {
let t_max: f64 = hit_left.t;
if let Some(hit_right) = self.right.as_ref().hit(&ray, t_min, t_max) {
return Some(hit_right);
}
return Some(hit_left);
}
return self.right.as_ref().hit(&ray, t_min, t_max);
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
Some(self.node_box.clone())
}
}
pub struct HittableList {
hittables: Vec<Arc<dyn Hittable>>,
list_boundaries: AABB,
}
impl HittableList {
pub fn from_slice(
data: &[Arc<dyn Hittable>],
t0: f64,
t1: f64,
_rng: &mut impl RngCore,
) -> HittableList {
let mut aabb = AABB::zeros();
for hittable in data {
if let Some(other) = hittable.bounding_box(t0, t1) {
aabb = aabb.union(&other);
}
}
HittableList {
hittables: data.to_vec(),
list_boundaries: aabb,
}
}
}
impl Hittable for HittableList {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord> {
let mut closest_record: Option<HitRecord> = None;
for hittable in &self.hittables {
if let Some(record) = hittable.as_ref().hit(ray, t_min, t_max) {
if closest_record.is_none() || record.t < closest_record.as_ref().unwrap().t {
closest_record = Some(record);
}
}
}
closest_record
}
fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> {
Some(self.list_boundaries.clone())
}
}
|
use crate::cli;
use crate::intcode;
use crate::intcode::{Int, Program};
const MAGIC_TARGET_VALUE: Int = 19690720;
pub fn run() {
let filename = cli::aoc_filename("aoc_2019_02.txt");
let prog = intcode::read_from_file(filename);
println!("Part One: {}", eval_noun_verb(&prog, 12, 2));
let mut result: Int = -1;
'outer: for n in 0..=99 {
for v in 0..=99 {
if eval_noun_verb(&prog, n, v) == MAGIC_TARGET_VALUE {
result = n * 100 + v;
break 'outer;
}
}
}
println!("Part Two: {}", result);
}
fn eval_noun_verb(prog: &Program, noun: Int, verb: Int) -> Int {
let mut m = intcode::Machine::new(&prog);
m.write_addr(1, noun);
m.write_addr(2, verb);
m.run();
m.read_addr(0)
}
|
use itertools::Itertools;
use whiteread::parse_line;
use std::collections::HashSet;
fn main() {
let n: u64 = parse_line().unwrap();
let s: String = parse_line().unwrap();
let mut one = HashSet::new();
let mut two: HashSet<(usize, usize)> = HashSet::new();
let mut three: HashSet<(usize, usize, usize)> = HashSet::new();
// a b c
for c in s.chars() {
let ci = c.to_string().parse::<usize>().unwrap();
for (o, t) in two.iter() {
three.insert((*o, *t, ci));
}
for o in one.iter() {
two.insert((*o, ci));
}
one.insert(ci);
}
println!("{}", three.len());
}
|
use crate::prelude::*;
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
#[derive(Debug)]
pub struct VkImageViewCreateInfo {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub flags: VkImageViewCreateFlagBits,
pub image: VkImage,
pub viewType: VkImageViewType,
pub format: VkFormat,
pub components: VkComponentMapping,
pub subresourceRange: VkImageSubresourceRange,
}
impl VkImageViewCreateInfo {
pub fn new<T>(
flags: T,
image: VkImage,
view_type: VkImageViewType,
format: VkFormat,
components: VkComponentMapping,
subresourceRange: VkImageSubresourceRange,
) -> Self
where
T: Into<VkImageViewCreateFlagBits>,
{
VkImageViewCreateInfo {
sType: VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
pNext: ptr::null(),
flags: flags.into(),
image,
viewType: view_type,
format,
components,
subresourceRange,
}
}
}
|
use datamodel_parser::RootTypes;
use datamodel_parser::DataModelTypeRef;
use datamodel_parser::DataModelFieldDeclaration;
use std::string::String;
use std::fmt::{Write, Error};
use std::collections::HashMap;
pub struct DOTFormatterOptions {}
struct Port {
left: Option<String>,
right: Option<String>,
}
pub fn format(
_options: DOTFormatterOptions,
types: Vec<RootTypes>,
) -> Result<String, Error> {
let mut value = String::new();
let mut ports: HashMap<String, Port> = HashMap::new();
value.write_str("digraph model {\r\n")?;
let type_iter = types.iter();
for val in type_iter {
match val {
RootTypes::Scalar(_s) => {
// no op
},
RootTypes::Type(t) => {
value.write_str(&format!("\ttable{} [\r\n", t.name))?;
value.write_str("\t\tshape=plaintext\r\n")?;
value.write_str("\t\tlabel=<\r\n")?;
value.write_str("\t\t\t<table border='0' cellborder='1' cellspacing='0'>\r\n")?;
value.write_str(&format!("\t\t\t\t<tr><td colspan='2'>{}</td></tr>\r\n", t.name))?;
let field_iter = t.fields.iter();
for field in field_iter {
let field_type = get_field_type(&field.field_type);
let relation = get_relation_directive(&field);
match relation {
None => value.write_str(&format!("\t\t\t\t<tr><td>{}</td><td>{}</td></tr>\r\n", field.name, field_type))?,
Some(relation_name) => {
let port_name = relation_name.clone();
let entry_name = relation_name.clone();
let root_type = get_root_field_type(&field.field_type);
let mut port = ports.entry(entry_name).or_insert(Port{
left: None,
right: None
});
if field_type.starts_with("[") {
port.right = Some(format!("table{}", root_type));
} else {
port.left = Some(format!("table{}", root_type));
}
value.write_str(&format!("\t\t\t\t<tr><td port='{}'>{}</td><td>{}</td></tr>\r\n", port_name, field.name, field_type))?;
}
}
}
value.write_str("\t\t\t</table>")?;
value.write_str(">\t];\r\n")?;
}
}
}
let port_iter = ports.iter();
for port_entry in port_iter {
let port = &port_entry.1;
let port_name = port_entry.0;
let left_side = match port.left {
Some(ref v) => v.clone(),
None => "<missing>".to_string()
};
let right_side = match port.right {
Some(ref v) => v.clone(),
None => "<missing>".to_string()
};
value.write_str(&format!("\t{}:{} -> {}:{};\r\n", left_side, port_name, right_side, port_name))?;
}
value.write_str("}\r\n")?;
Ok(value.to_owned())
}
fn get_field_type(field: &DataModelTypeRef) -> String {
let ref reffed = field.inner_type;
let required;
if field.required { required = "!"; } else { required = ""; };
match reffed {
Some(v) => format!("[{}]{}", get_field_type(v.as_ref()), required),
None => format!("{}{}", field.name, required),
}
}
fn get_root_field_type(field: &DataModelTypeRef) -> String {
let ref reffed = field.inner_type;
match reffed {
Some(v) => get_root_field_type(v.as_ref()),
None => field.name.to_owned(),
}
}
fn get_relation_directive(field: &DataModelFieldDeclaration) -> Option<String> {
let directive_iter = field.directives.iter();
for directive in directive_iter {
if directive.name == "relation" {
let arg_iter = directive.arguments.iter();
for arg in arg_iter {
if arg.name == "name" {
return Some(arg.value.to_owned());
}
}
}
};
None
}
|
// Copyright 2019 Stichting Organism
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Schnorr Public Key generation,
use crate::keys::SecretKey;
use crate::SchnorrError;
use mohan::{
dalek::{
constants,
ristretto::{CompressedRistretto, RistrettoPoint},
scalar::Scalar,
},
ser,
tools::RistrettoBoth,
};
use std::fmt::Debug;
/// The length of an ed25519 Schnorr `PublicKey`, in bytes.
pub const PUBLIC_KEY_LENGTH: usize = 32;
/// An Schnorr public key.
#[derive(Copy, Clone, Default)]
pub struct PublicKey(pub(crate) RistrettoBoth);
impl Debug for PublicKey {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
write!(f, "PublicKey( CompressedRistretto( {:?} ))", self.0)
}
}
impl ::zeroize::Zeroize for PublicKey {
fn zeroize(&mut self) {
self.0.zeroize()
}
}
impl PublicKey {
/// Access the compressed Ristretto form
pub fn as_compressed(&self) -> &CompressedRistretto {
&self.0.as_compressed()
}
/// Extract the compressed Ristretto form
pub fn into_compressed(self) -> CompressedRistretto {
self.0.into_compressed()
}
/// Access the point form
pub fn as_point(&self) -> &RistrettoPoint {
&self.0.as_point()
}
/// Extract the point form
pub fn into_point(self) -> RistrettoPoint {
self.0.into_point()
}
/// Decompress into the `PublicKey` format that also retains the
/// compressed form.
pub fn from_compressed(compressed: CompressedRistretto) -> Result<PublicKey, SchnorrError> {
match RistrettoBoth::from_compressed(compressed) {
None => Err(SchnorrError::PointDecompressionError),
Some(kosher) => Ok(PublicKey(kosher)),
}
}
/// Compress into the `PublicKey` format that also retains the
/// uncompressed form.
pub fn from_point(point: RistrettoPoint) -> PublicKey {
PublicKey(RistrettoBoth::from_point(point))
}
/// Convert this public key to a byte array.
#[inline]
pub fn to_bytes(&self) -> [u8; PUBLIC_KEY_LENGTH] {
self.0.to_bytes()
}
/// View this public key as a byte array.
#[inline]
pub fn as_bytes<'a>(&'a self) -> &'a [u8; PUBLIC_KEY_LENGTH] {
&self.0.as_compressed().0
}
/// Construct a `PublicKey` from a slice of bytes.
///
/// # Warning
///
/// The caller is responsible for ensuring that the bytes passed into this
/// method actually represent a `curve25519_dalek::curve::CompressedRistretto`
/// and that said compressed point is actually a point on the curve.
///
/// # Example
///
/// ```
/// # extern crate schnorr;
/// #
/// use schnorr::*;
///
/// # fn doctest() -> Result<PublicKey, SchnorrError> {
/// let public_key_bytes: [u8; PUBLIC_KEY_LENGTH] = [
/// 215, 90, 152, 1, 130, 177, 10, 183, 213, 75, 254, 211, 201, 100, 7, 58,
/// 14, 225, 114, 243, 218, 166, 35, 37, 175, 2, 26, 104, 247, 7, 81, 26];
///
/// let public_key = PublicKey::from_bytes(&public_key_bytes)?;
/// #
/// # Ok(public_key)
/// # }
/// #
/// # fn main() {
/// # doctest();
/// # }
/// ```
///
/// # Returns
///
/// A `Result` whose okay value is an Schnorr `PublicKey` or whose error value
/// is an `SchnorrError` describing the error that occurred.
#[inline]
pub fn from_bytes(bytes: &[u8]) -> Result<PublicKey, SchnorrError> {
match RistrettoBoth::from_bytes(bytes) {
Some(pk) => Ok(PublicKey(pk)),
None => Err(SchnorrError::SerError),
}
}
/// Derive this public key from its corresponding `SecretKey`.
pub fn from_secret(secret_key: &SecretKey) -> PublicKey {
Self::from_secret_uncompressed(secret_key.as_scalar())
}
/// Helper Function to convert [Scalar] into PubKey
pub(crate) fn from_secret_uncompressed(privkey: &Scalar) -> PublicKey {
PublicKey(RistrettoBoth::from_point(
privkey * &constants::RISTRETTO_BASEPOINT_TABLE,
))
}
}
impl From<SecretKey> for PublicKey {
fn from(source: SecretKey) -> PublicKey {
PublicKey::from_secret(&source)
}
}
//Ordering Support, needed to be specific for MuSig
impl PartialEq for PublicKey {
fn eq(&self, other: &PublicKey) -> bool {
// Although this is slower than `self.compressed == other.compressed`, expanded point comparison is an equal
// time comparision
self.as_point() == other.as_point()
}
}
impl Eq for PublicKey {}
impl PartialOrd for PublicKey {
fn partial_cmp(&self, other: &PublicKey) -> Option<std::cmp::Ordering> {
self.partial_cmp(&other)
}
}
impl Ord for PublicKey {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.cmp(&other)
}
}
impl ser::Writeable for PublicKey {
fn write<W: ser::Writer>(&self, writer: &mut W) -> Result<(), ser::Error> {
self.0.write(writer)?;
Ok(())
}
}
impl ser::Readable for PublicKey {
fn read(reader: &mut dyn ser::Reader) -> Result<PublicKey, ser::Error> {
Ok(PublicKey(RistrettoBoth::read(reader)?))
}
}
|
use core::intrinsics;
use core::iter::Iterator;
use core::ops::Range;
/// Provides volatile read/write access to a location in memory. This prevents
/// the compiler's optimizer from trying to mess with our register operations.
pub struct Register<T> {
value: T
}
impl<T> Register<T> {
/// Perform a volatile read operation on the memory.
pub fn read(&self) -> T {
unsafe {
return intrinsics::volatile_load(&self.value);
}
}
/// Perform a volatile write operation on the memory.
pub fn write(&mut self, new_value: T) {
unsafe {
intrinsics::volatile_store(&mut self.value, new_value);
}
}
}
/// Transform a range to a bitmask by setting all bits of the range.
///
/// # Examples
///
/// ```
/// let m = bitmask(0..2);
/// assert_eq!(m, (1 << 0) | (1 << 1) | (1 << 2));
/// ```
pub fn bitmask(range: Range<u8>) -> u32 {
// Range operator creates the range [start, end). STM32 datasheets define
// register ranges as [start, end].
let inclusive_range = Range {
start: range.start,
end: range.end + 1
};
inclusive_range.fold(0, |mask, bit| mask | (1 << bit))
}
macro_rules! register {
($name:ident; $($getter:ident, $setter:ident, $mask:expr);*) => {
pub struct $name {
value: Register<u32>
}
impl $name {
$(
reg_bit!($getter, $setter, $mask);
)*
}
}
}
macro_rules! reg_bit {
($getter:ident, $setter:ident, $mask:expr) => {
pub fn $getter(&self) -> u32 {
use hal::register::bitmask;
self.value.read() & bitmask($mask) >> $mask.start
}
pub fn $setter(&mut self, v: u32) {
use hal::register::bitmask;
let clear_mask = !(1 << $mask.start);
let cleared = self.value.read() & clear_mask;
self.value.write(cleared | (v << $mask.start & bitmask($mask)));
}
};
}
|
use std::thread;
fn main() {
let child = thread::spawn(move || {
println!("Hello thread");
});
let res = child.join();
} |
use std::collections;
use super::zobrist::BoardHasher;
use super::zobrist::PosHash;
use super::super::go::GoGame;
fn generate_hashes(depth: usize, hasher: &BoardHasher, game: &mut GoGame,
seen: &mut collections::HashMap<PosHash, GoGame>) {
if depth <= 0 {
return;
}
for v in game.possible_moves(game.to_play) {
let c = game.to_play;
game.play(c, v);
let hash = hasher.hash(&game);
if seen.contains_key(&hash) {
assert_eq!(game, seen.get(&hash).unwrap());
}
seen.insert(hash, game.clone());
generate_hashes(depth - 1, hasher, game, seen);
game.undo(1);
}
}
#[test]
fn hash_collision() {
let hasher = BoardHasher::new();
let mut game = GoGame::new(9);
let mut seen = collections::HashMap::<PosHash, GoGame>::new();
generate_hashes(2, &hasher, &mut game, &mut seen);
} |
use crate::event::GameEvent;
use crate::resources::Resources;
use shrev::{EventChannel, ReaderId};
pub struct GameOver {
rdr_id: ReaderId<GameEvent>,
}
impl GameOver {
pub fn new(resources: &mut Resources) -> Self {
let mut chan = resources.fetch_mut::<EventChannel<GameEvent>>().unwrap();
let rdr_id = chan.register_reader();
Self { rdr_id }
}
pub fn game_over(&mut self, resources: &Resources) -> bool {
let chan = resources.fetch::<EventChannel<GameEvent>>().unwrap();
for ev in chan.read(&mut self.rdr_id) {
if let GameEvent::GameOver = ev {
return true;
}
}
return false;
}
}
|
use bintree::Tree;
use std::fmt;
use P55::cbal_trees;
use P56::is_symmetric;
pub fn symmetric_balanced_trees<T: Copy + fmt::Display>(n: usize, v: T) -> Vec<Tree<T>> {
cbal_trees(n, v)
.into_iter()
.filter(|t| is_symmetric(&t))
.collect()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_symmetric_balanced_trees() {
let trees = symmetric_balanced_trees(5, 'x');
assert!(trees.contains(&Tree::node(
'x',
Tree::node('x', Tree::end(), Tree::node('x', Tree::end(), Tree::end())),
Tree::node('x', Tree::node('x', Tree::end(), Tree::end()), Tree::end())
)));
assert!(trees.contains(&Tree::node(
'x',
Tree::node('x', Tree::node('x', Tree::end(), Tree::end()), Tree::end()),
Tree::node('x', Tree::end(), Tree::node('x', Tree::end(), Tree::end()))
)));
}
}
|
use advent::helpers;
use anyhow::{Context, Result};
use derive_more::Display;
use helpers::grid::Grid;
use itertools::Itertools;
use num_integer::Roots;
use std::ops::RangeInclusive;
use std::{collections::VecDeque, str::FromStr};
#[derive(Debug, Clone, Copy, Display, PartialEq, Eq)]
enum Pixel {
#[display(fmt = ".")]
Empty,
#[display(fmt = "#")]
Full,
#[display(fmt = " ")]
Wildcard,
#[display(fmt = "O")]
Monster,
}
type TileId = u32;
type Pixels = Grid<Pixel>;
#[derive(Debug, Display, Clone)]
#[display(fmt = "Tile {}:\n{}", id, pixels)]
struct ImageTile {
id: TileId,
pixels: Pixels,
}
impl FromStr for Pixel {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.chars().next() {
None => anyhow::bail!("No pixel character"),
Some('.') => Ok(Pixel::Empty),
Some('#') => Ok(Pixel::Full),
Some(' ') => Ok(Pixel::Wildcard),
Some('O') => Ok(Pixel::Monster),
_ => anyhow::bail!("Invalid pixel"),
}
}
}
impl FromStr for ImageTile {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let s = s.trim();
let id_line = s
.lines()
.next()
.ok_or_else(|| anyhow::anyhow!("No tile id found"))?;
let first_newline = s
.find('\n')
.ok_or_else(|| anyhow::anyhow!("No newline found"))?;
let pixels_str = s
.get(first_newline..)
.ok_or_else(|| anyhow::anyhow!("No pixel data found"))?;
let id = id_line
.split_whitespace()
.nth(1)
.ok_or_else(|| anyhow::anyhow!("No separator found before tile id"))?
.get(..4)
.ok_or_else(|| anyhow::anyhow!("No tile id found"))?
.parse::<TileId>()
.map_err(|_| anyhow::anyhow!("Non numeric tile id found"))?;
let pixels = pixels_str.parse::<Pixels>()?;
ImageTile::new(id, pixels).ok()
}
}
impl ImageTile {
fn new(id: TileId, pixels: Grid<Pixel>) -> Self {
ImageTile { id, pixels }
}
fn ok(self) -> Result<Self> {
Ok(self)
}
/*
1 2 3
4 5 6
7 8 9
7 4 1 0,0 -> 0,2 1,0 -> 0,1 2,0 -> 0,0
8 5 2 0,1 -> 1,2 1,1 -> 1,1 2,1 -> 1,0
9 6 3 0,2 -> 2,2 1,2 -> 2,1 2,2 -> 2,0
*/
fn rotate_cw(&mut self) {
let pixels = &self.pixels;
let mut copy = pixels.clone();
let it = (0..pixels.rows()).cartesian_product(0..pixels.cols());
it.for_each(|(r, c)| {
let src = (r, c);
let tgt = (c, pixels.rows() - 1 - r);
let src_ref = pixels.get(src).unwrap();
let copy_ref = copy.get_mut(tgt).unwrap();
*copy_ref = *src_ref;
});
self.pixels = copy;
}
fn rotate_cw_count(&mut self, count: usize) {
for _ in 0..count {
self.rotate_cw()
}
}
fn flip_horizontal(&mut self) {
for r in 0..(self.pixels.rows() / 2) {
for c in 0..self.pixels.cols() {
let src = (r, c);
let tgt = (self.pixels.rows() - 1 - r, c);
let tmp = *self.pixels.get(src).unwrap();
*self.pixels.get_mut(src).unwrap() = *self.pixels.get(tgt).unwrap();
*self.pixels.get_mut(tgt).unwrap() = tmp;
}
}
}
fn flip_vertical(&mut self) {
for r in 0..(self.pixels.rows()) {
for c in 0..self.pixels.cols() / 2 {
let src = (r, c);
let tgt = (r, self.pixels.cols() - 1 - c);
let tmp = *self.pixels.get(src).unwrap();
*self.pixels.get_mut(src).unwrap() = *self.pixels.get(tgt).unwrap();
*self.pixels.get_mut(tgt).unwrap() = tmp;
}
}
}
fn mutations_iter(&self) -> ImageTileMutationsIter {
ImageTileMutationsIter {
tile: self,
next_index: Some(0),
}
}
fn side_iter(&self, tile_side: &ImageTileSide) -> ImageTileSideIter {
ImageTileSideIter {
tile: self,
tile_side: *tile_side,
next_index: Some(0),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum ImageTileSide {
Top,
Right,
Bottom,
Left,
}
impl ImageTileSide {
fn opposite(&self) -> ImageTileSide {
match self {
ImageTileSide::Top => ImageTileSide::Bottom,
ImageTileSide::Right => ImageTileSide::Left,
ImageTileSide::Bottom => ImageTileSide::Top,
ImageTileSide::Left => ImageTileSide::Right,
}
}
fn point_delta(&self) -> Point2DTuple {
match self {
ImageTileSide::Top => (-1, 0),
ImageTileSide::Right => (0, 1),
ImageTileSide::Bottom => (1, 0),
ImageTileSide::Left => (0, -1),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum ImageTileMutationKind {
Original,
Rotate90,
Rotate180,
Rotate270,
FlipHorizontal,
FlipHorizontalRotate90,
FlipHorizontalRotate180,
FlipHorizontalRotate270,
FlipVertical,
FlipVerticalRotate90,
FlipVerticalRotate180,
FlipVerticalRotate270,
}
struct ImageTileMutationsIter<'a> {
tile: &'a ImageTile,
next_index: Option<usize>,
}
impl<'a> std::iter::Iterator for ImageTileMutationsIter<'_> {
type Item = (ImageTile, ImageTileMutationKind);
fn next(&mut self) -> Option<Self::Item> {
self.next_index
.and_then(|i| if i < 12 { Some(i) } else { None })
.map(|i| {
let mut tile = self.tile.clone();
let kind = match i {
0 => ImageTileMutationKind::Original,
1 => {
tile.rotate_cw_count(1);
ImageTileMutationKind::Rotate90
}
2 => {
tile.rotate_cw_count(2);
ImageTileMutationKind::Rotate180
}
3 => {
tile.rotate_cw_count(3);
ImageTileMutationKind::Rotate270
}
4 => {
tile.flip_horizontal();
ImageTileMutationKind::FlipHorizontal
}
5 => {
tile.flip_horizontal();
tile.rotate_cw_count(1);
ImageTileMutationKind::FlipHorizontalRotate90
}
6 => {
tile.flip_horizontal();
tile.rotate_cw_count(2);
ImageTileMutationKind::FlipHorizontalRotate180
}
7 => {
tile.flip_horizontal();
tile.rotate_cw_count(3);
ImageTileMutationKind::FlipHorizontalRotate270
}
8 => {
tile.flip_vertical();
ImageTileMutationKind::FlipVertical
}
9 => {
tile.flip_vertical();
tile.rotate_cw_count(1);
ImageTileMutationKind::FlipVerticalRotate90
}
10 => {
tile.flip_vertical();
tile.rotate_cw_count(2);
ImageTileMutationKind::FlipVerticalRotate180
}
11 => {
tile.flip_vertical();
tile.rotate_cw_count(3);
ImageTileMutationKind::FlipVerticalRotate270
}
_ => unreachable!(),
};
self.next_index = Some(i + 1);
(tile, kind)
})
}
}
struct ImageTileSideIter<'a> {
tile: &'a ImageTile,
tile_side: ImageTileSide,
next_index: Option<usize>,
}
impl<'a> std::iter::Iterator for ImageTileSideIter<'_> {
type Item = Pixel;
fn next(&mut self) -> Option<Self::Item> {
self.next_index
.and_then(|i| {
if i < self.tile.pixels.rows() {
Some(i)
} else {
None
}
})
.map(|i| {
let pos = match self.tile_side {
ImageTileSide::Top => (0, i),
ImageTileSide::Right => (i, self.tile.pixels.cols() - 1),
ImageTileSide::Bottom => (self.tile.pixels.rows() - 1, i),
ImageTileSide::Left => (i, 0),
};
self.next_index = Some(i + 1);
*self.tile.pixels.get(pos).unwrap()
})
}
}
type ImageTilesMap = std::collections::HashMap<Point2D, ImageTile>;
#[derive(Debug, Clone)]
struct Image {
tiles: ImageTilesMap,
bounds: ImageTilePosBounds,
}
impl Image {
fn new() -> Self {
Self {
tiles: ImageTilesMap::new(),
bounds: ImageTilePosBounds {
row_range: 0..=0,
col_range: 0..=0,
},
}
}
fn display_ids(&self) -> ImageDisplayIds<'_> {
ImageDisplayIds { image: self }
}
fn update_bounds(&mut self) {
let p = self.tiles.keys().next().unwrap();
let mut r_min = p.r;
let mut r_max = p.r;
let mut c_min = p.c;
let mut c_max = p.c;
self.tiles.keys().for_each(|p| {
r_min = r_min.min(p.r);
r_max = r_max.max(p.r);
c_min = c_min.min(p.c);
c_max = c_max.max(p.c);
});
self.bounds = ImageTilePosBounds::new(r_min..=r_max, c_min..=c_max)
}
}
struct ImageDisplayIds<'a> {
image: &'a Image,
}
impl<'a> std::fmt::Display for ImageDisplayIds<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for r in self.image.bounds.row_range.clone() {
for c in self.image.bounds.col_range.clone() {
let value = self.image.tiles.get(&Point2D::new(r, c));
if let Some(value) = value {
write!(f, "{:5}", value.id)?;
}
}
if r != *self.image.bounds.row_range.end() {
writeln!(f)?;
}
}
Ok(())
}
}
#[derive(Debug)]
struct ImageDisplayTiles<'a> {
image: &'a Image,
}
#[derive(Debug, Clone, Copy, Display, PartialEq, Eq, Hash)]
#[display(fmt = "({}, {})", r, c)]
struct Point2D {
r: isize,
c: isize,
}
impl Point2D {
fn new(r: isize, c: isize) -> Point2D {
Point2D { r, c }
}
}
type Point2DTuple = (isize, isize);
impl std::ops::Add<Point2DTuple> for Point2D {
type Output = Self;
fn add(self, other: Point2DTuple) -> Self {
Self {
r: self.r + other.0,
c: self.c + other.1,
}
}
}
#[derive(Debug, Clone)]
struct ImageTilePosBounds {
row_range: RangeInclusive<isize>,
col_range: RangeInclusive<isize>,
}
impl ImageTilePosBounds {
fn new(
row_range: RangeInclusive<isize>,
col_range: RangeInclusive<isize>,
) -> ImageTilePosBounds {
ImageTilePosBounds {
row_range,
col_range,
}
}
}
// This might be an anti-pattern, but i just wanted to check if it works.
trait PrintableIter<T>
where
Self: std::ops::Deref<Target = [T]>,
T: std::fmt::Display,
{
fn print(&self) {
self.deref()
.iter()
.for_each(|value| println!("{}\n", value));
}
}
impl<Value, Container> PrintableIter<Value> for Container
where
Value: std::fmt::Display,
Container: std::ops::Deref<Target = [Value]>,
{
}
fn parse_image_tiles(s: &str) -> Vec<ImageTile> {
s.split("\n\n")
.map(|one_tile_str| one_tile_str.parse::<ImageTile>())
.try_collect()
.expect("Invalid image tiles")
}
#[allow(unused)]
fn try_match_tiles(
tile_1: &ImageTile,
tile_2: &ImageTile,
) -> Option<(ImageTileSide, ImageTileMutationKind, ImageTile)> {
let sides = [
ImageTileSide::Top,
ImageTileSide::Right,
ImageTileSide::Bottom,
ImageTileSide::Left,
];
for tile_1_side in &sides {
let maybe_match = try_match_tiles_with_side(tile_1, tile_1_side, tile_2);
if maybe_match.is_some() {
return maybe_match;
}
}
None
}
fn try_match_tiles_with_sides(
tile_1: &ImageTile,
tile_1_sides: &[ImageTileSide],
tile_2: &ImageTile,
) -> Option<(ImageTileSide, ImageTileMutationKind, ImageTile)> {
for tile_1_side in tile_1_sides {
let maybe_match = try_match_tiles_with_side(tile_1, tile_1_side, tile_2);
if maybe_match.is_some() {
return maybe_match;
}
}
None
}
fn try_match_tiles_with_side(
tile_1: &ImageTile,
tile_1_side: &ImageTileSide,
tile_2: &ImageTile,
) -> Option<(ImageTileSide, ImageTileMutationKind, ImageTile)> {
let tile_2_side = tile_1_side.opposite();
for (mutated_tile_2, kind) in tile_2.mutations_iter() {
let is_match = tile_1
.side_iter(tile_1_side)
.eq(mutated_tile_2.side_iter(&tile_2_side));
if is_match {
return Some((*tile_1_side, kind, mutated_tile_2));
}
}
None
}
fn tile_unoccupied_sides(tile_pos: &Point2D, image: &Image) -> Vec<ImageTileSide> {
let sides = [
ImageTileSide::Top,
ImageTileSide::Right,
ImageTileSide::Bottom,
ImageTileSide::Left,
];
sides
.iter()
.filter(|side| {
let tile_pos = *tile_pos + side.point_delta();
!image.tiles.contains_key(&tile_pos)
})
.cloned()
.collect_vec()
}
fn solve_jigsaw(s: &str) -> Image {
let mut tiles = parse_image_tiles(s)
.into_iter()
.collect::<VecDeque<ImageTile>>();
println!("Initial tile count: {}", tiles.len());
let mut unmatched = VecDeque::<ImageTile>::new();
let mut image = Image::new();
image
.tiles
.insert(Point2D::new(0, 0), tiles.pop_front().unwrap());
loop {
let mut tiles_added = false;
let mut matched_tiles_to_add = Vec::<(Point2D, ImageTile)>::new();
for (pos_1, tile_1) in image.tiles.iter() {
while let Some(tile_2) = tiles.pop_front() {
let tile_1_sides = tile_unoccupied_sides(pos_1, &image);
let maybe_match = try_match_tiles_with_sides(tile_1, &tile_1_sides, &tile_2);
if let Some((side_1, _kind, mutated_tile_2)) = maybe_match {
let pos_2 = *pos_1 + side_1.point_delta();
matched_tiles_to_add.push((pos_2, mutated_tile_2));
break;
} else {
unmatched.push_front(tile_2);
}
}
if !matched_tiles_to_add.is_empty() {
tiles.extend(unmatched.drain(..));
break;
}
std::mem::swap(&mut tiles, &mut unmatched);
}
if !matched_tiles_to_add.is_empty() {
tiles_added = true;
}
image.tiles.extend(matched_tiles_to_add);
image.update_bounds();
if !tiles_added {
println!("Remaining tile count: {}", tiles.len());
break;
}
}
println!("{}", image.display_ids());
println!("Final tile count: {}", image.tiles.len());
image
}
fn multiply_corner_tile_ids(s: &str) -> u64 {
let image = solve_jigsaw(s);
let rows = [
*image.bounds.row_range.start(),
*image.bounds.row_range.end(),
];
let cols = [
*image.bounds.col_range.start(),
*image.bounds.col_range.end(),
];
let result: u64 = rows
.iter()
.cartesian_product(cols.iter())
.map(|(r, c)| {
let point = Point2D::new(*r, *c);
let id = image.tiles.get(&point).unwrap().id as u64;
id
})
.product();
result
}
fn assemble_final_image_tile(image: Image) -> ImageTile {
let image_tile_rows = image.tiles.len().sqrt();
let tile_side_size = image.tiles[&Point2D::new(0, 0)].pixels.rows();
let image_side_size_no_borders = (tile_side_size - 2) * image_tile_rows;
let pixels = vec![Pixel::Empty; image_side_size_no_borders * image_side_size_no_borders];
let mut assembled_tile = ImageTile::new(
0,
Pixels::new(
image_side_size_no_borders,
image_side_size_no_borders,
pixels,
),
);
for r in image.bounds.row_range.clone() {
for c in image.bounds.col_range.clone() {
let tile = &image.tiles[&Point2D::new(r, c)];
let normalized_r = r + (-image.bounds.row_range.start());
let normalized_c = c + (-image.bounds.col_range.start());
let tile_shifting_r = normalized_r as usize * (tile_side_size - 2);
let tile_shifting_c = normalized_c as usize * (tile_side_size - 2);
for tile_r in 1..tile.pixels.rows() - 1 {
for tile_c in 1..tile.pixels.cols() - 1 {
let pixel = tile.pixels.get((tile_r, tile_c)).unwrap();
let new_pos = (tile_r - 1 + tile_shifting_r, tile_c - 1 + tile_shifting_c);
*assembled_tile.pixels.get_mut(new_pos).unwrap() = *pixel;
}
}
}
}
assembled_tile
}
const MONSTER_STR: &str = r" #
# ## ## ###
# # # # # # ";
fn parse_monster() -> Result<Grid<Pixel>, anyhow::Error> {
let s = MONSTER_STR;
let g = s
.lines()
.flat_map(|l| l.chars().map(|c| c.to_string().parse::<Pixel>()))
.try_collect()?;
let rows = s.lines().count();
let cols = s
.lines()
.next()
.map(|l| l.chars().count())
.ok_or_else(|| anyhow::anyhow!("Row has no tiles"))?;
Ok(Grid::new(rows, cols, g))
}
fn monster() -> &'static ImageTile {
static INSTANCE: once_cell::sync::Lazy<ImageTile> = once_cell::sync::Lazy::new(|| {
// Can't use FromStr<Grid> because it does a trim() :/
let pixels = parse_monster().expect("Invalid monster");
ImageTile::new(1, pixels)
});
&INSTANCE
}
fn is_monster_at_pos(image: &ImageTile, pos: (usize, usize), monster: &ImageTile) -> bool {
let monster_rows = monster.pixels.rows();
let monster_cols = monster.pixels.cols();
for r in 0..monster_rows {
for c in 0..monster_cols {
let monster_pixel = monster.pixels.get((r, c)).unwrap();
let image_pixel = image.pixels.get((pos.0 + r, pos.1 + c)).unwrap();
match (monster_pixel, image_pixel) {
(Pixel::Full, Pixel::Full) => (),
(Pixel::Full, _) => return false,
(_, _) => (),
}
}
}
true
}
fn mark_monster_at_pos(image: &mut ImageTile, pos: (usize, usize), monster: &ImageTile) {
let monster_rows = monster.pixels.rows();
let monster_cols = monster.pixels.cols();
for r in 0..monster_rows {
for c in 0..monster_cols {
let monster_pixel = monster.pixels.get((r, c)).unwrap();
let image_pixel = image.pixels.get_mut((pos.0 + r, pos.1 + c)).unwrap();
match (*monster_pixel, *image_pixel) {
(Pixel::Full, Pixel::Full) => {
*image_pixel = Pixel::Monster;
}
(_, _) => (),
}
}
}
}
fn mark_monsters(image: &ImageTile, monster: &ImageTile) -> Option<ImageTile> {
for (mut mutated_image, _) in image.mutations_iter() {
let mut image_has_monsters = false;
for r in 0..(image.pixels.rows() - monster.pixels.rows()) {
for c in 0..(image.pixels.cols() - monster.pixels.cols()) {
let is_match = is_monster_at_pos(&mutated_image, (r, c), monster);
if is_match {
image_has_monsters = true;
// println!("match at ({},{})", r, c);
mark_monster_at_pos(&mut mutated_image, (r, c), monster);
}
}
}
if image_has_monsters {
return Some(mutated_image);
}
}
None
}
fn filter_non_monster_pixels(image: &mut ImageTile) {
for r in 0..image.pixels.rows() {
for c in 0..image.pixels.cols() {
let pixel = image.pixels.get_mut((r, c)).unwrap();
match pixel {
Pixel::Monster => (),
_ => *pixel = Pixel::Wildcard,
}
}
}
}
fn count_rough_water(image: &ImageTile) -> u32 {
let mut count = 0;
for r in 0..image.pixels.rows() {
for c in 0..image.pixels.cols() {
let pixel = image.pixels.get((r, c)).unwrap();
if let Pixel::Full = pixel {
count += 1;
}
}
}
count
}
fn check_water_roughness(s: &str) -> u32 {
let image = solve_jigsaw(s);
let tile = assemble_final_image_tile(image);
let monster = monster();
// println!("{}", monster);
let image_with_monsters = mark_monsters(&tile, monster);
if let Some(mut image_with_monsters) = image_with_monsters {
let rought_water_count = count_rough_water(&image_with_monsters);
filter_non_monster_pixels(&mut image_with_monsters);
println!("{}", image_with_monsters);
return rought_water_count;
}
0
}
fn solve_p1() -> Result<()> {
let input = helpers::get_data_from_file_res("d20").context("Coudn't read file contents.")?;
let result = multiply_corner_tile_ids(&input);
println!("The multiplication of the 4 corner tile ids is: {}", result);
Ok(())
}
fn solve_p2() -> Result<()> {
let input = helpers::get_data_from_file_res("d20").context("Coudn't read file contents.")?;
let result = check_water_roughness(&input);
println!("Water roughness is: {}", result);
Ok(())
}
fn main() -> Result<()> {
solve_p1().ok();
solve_p2().ok();
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_basic_ops() {
let tile = "
Tile 2311:
..##.#..#.
##..#.....
#...##..#.
####.#...#
##.##.###.
##...#.###
.#.#.#..##
..#....#..
###...#.#.
..###..###";
let tile = tile.parse::<ImageTile>().unwrap();
let mut tile_2 = tile.clone();
tile_2.rotate_cw_count(4);
assert_eq!(tile.pixels, tile_2.pixels);
tile_2.flip_horizontal();
tile_2.flip_horizontal();
assert_eq!(tile.pixels, tile_2.pixels);
tile_2.flip_vertical();
tile_2.flip_vertical();
assert_eq!(tile.pixels, tile_2.pixels);
let side: String = tile
.side_iter(&ImageTileSide::Top)
.map(|elem| format!("{}", elem))
.collect();
assert_eq!(side, "..##.#..#.");
let side: String = tile
.side_iter(&ImageTileSide::Right)
.map(|elem| format!("{}", elem))
.collect();
assert_eq!(side, "...#.##..#");
let side: String = tile
.side_iter(&ImageTileSide::Bottom)
.map(|elem| format!("{}", elem))
.collect();
assert_eq!(side, "..###..###");
let side: String = tile
.side_iter(&ImageTileSide::Left)
.map(|elem| format!("{}", elem))
.collect();
assert_eq!(side, ".#####..#.");
// Iterator side equality.
assert!(tile
.side_iter(&ImageTileSide::Left)
.eq(tile.side_iter(&ImageTileSide::Left)));
}
#[test]
fn test_matcher() {
let tile = "
Tile 1951:
#.##...##.
#.####...#
.....#..##
#...######
.##.#....#
.###.#####
###.##.##.
.###....#.
..#.#..#.#
#...##.#..";
let tile_1 = tile.parse::<ImageTile>().unwrap();
let tile = "
Tile 2311:
..##.#..#.
##..#.....
#...##..#.
####.#...#
##.##.###.
##...#.###
.#.#.#..##
..#....#..
###...#.#.
..###..###";
let tile_2 = tile.parse::<ImageTile>().unwrap();
let maybe_match = try_match_tiles(&tile_1, &tile_2).unwrap();
assert_eq!(maybe_match.0, ImageTileSide::Right);
assert_eq!(maybe_match.1, ImageTileMutationKind::Original);
}
#[test]
fn test_p1() {
macro_rules! test {
($expr: literal, $solution: expr) => {
let input = helpers::get_data_from_file_res($expr)
.context("Coudn't read file contents.")
.unwrap();
assert_eq!(multiply_corner_tile_ids(&input), $solution)
};
}
test!("d20_sample", 20899048083289);
}
#[test]
fn test_p2() {
macro_rules! test {
($expr: literal, $solution: expr) => {
let input = helpers::get_data_from_file_res($expr)
.context("Coudn't read file contents.")
.unwrap();
assert_eq!(check_water_roughness(&input), $solution)
};
}
test!("d20_sample", 273);
}
}
|
use libc::{opendir, readdir, chdir, closedir};
use std::ffi::CStr;
fn main() {
let dir_path = b".\x00".as_ptr() as *const i8;
let dir = unsafe { opendir(dir_path) };
unsafe { chdir(dir_path); }
loop{
let dirent = unsafe { readdir(dir) };
if dirent.is_null(){
break;
}
let d_name = (unsafe { *dirent }).d_name.as_ptr() as *mut i8;
let d_name: &CStr = unsafe { CStr::from_ptr(d_name) };
let d_name = d_name.to_str().unwrap();
println!("{}", d_name);
}
unsafe { closedir(dir); }
} |
#![allow(unused)]
use crate::style::StyledNode;
use crate::css;
use crate::css::{Value,Unit};
#[derive(Default, Clone, Copy)]
struct Dimensions {
content: Rect,
padding: EdgeSizes,
border: EdgeSizes,
margin: EdgeSizes,
}
impl Dimensions {
fn padding_box(self) -> Rect {
self.content.expanded_by(self.padding)
}
fn border_box(&self) -> Rect {
self.padding_box().expanded_by(self.border)
}
fn margin_box(&self) -> Rect {
self.border_box().expanded_by(self.margin)
}
}
#[derive(Default, Clone, Copy)]
struct Rect {
x: f32,
y: f32,
width: f32,
height: f32,
}
impl Rect {
fn expanded_by(self, edge: EdgeSizes) -> Rect {
Rect {
x: self.x - edge.left,
y: self.y - edge.top,
width: self.width + edge.left + edge.right,
height: self.height + edge.top + edge.bottom
}
}
}
#[derive(Default, Clone, Copy)]
struct EdgeSizes {
top: f32,
right: f32,
bottom: f32,
left: f32,
}
struct LayoutBox<'a> {
dimensions: Dimensions,
box_type: BoxType<'a>,
children: Vec<LayoutBox<'a>>,
}
impl<'a> LayoutBox<'a> {
fn new(box_type: BoxType) -> LayoutBox {
LayoutBox {
box_type: box_type,
dimensions: Default::default(),
children: Vec::new(),
}
}
fn get_inline_container(&mut self) -> &mut LayoutBox<'a> {
match self.box_type {
BoxType::InlineNode(_) | BoxType::AnonymousBlock => self,
BoxType::BlockNode(_) => {
match self.children.last() {
Some(&LayoutBox {box_type: BoxType::AnonymousBlock,..}) => {},
_ => self.children.push(LayoutBox::new(BoxType::AnonymousBlock))
}
self.children.last_mut().unwrap()
}
}
}
fn get_style_node(&self) -> &'a StyledNode<'a> {
match self.box_type {
BoxType::BlockNode(node) | BoxType::InlineNode(node) => node,
BoxType::AnonymousBlock => panic!("Anonymous block box has no style node")
}
}
}
enum BoxType<'a> {
BlockNode(&'a StyledNode<'a>),
InlineNode(&'a StyledNode<'a>),
AnonymousBlock,
}
pub enum Display {
Inline,
Block,
None,
}
impl StyledNode<'_> {
fn value(&self, name: &str) -> Option<css::Value> {
self.specified_values.get(name).map(|v| v.clone())
}
fn display(&self) -> Display {
match self.value("display") {
Some(css::Value::Keyword(s)) => match &s[..]{
"block" => Display::Block,
"none" => Display::Inline,
_ => Display::Inline
}
_ => Display::Inline
}
}
fn lookup(&self, name: &str, name1: &str, default: &css::Value) -> css::Value {
self.value(name).unwrap_or_else(|| self.value(name1).unwrap_or_else(|| default.clone()))
}
}
fn build_layout_tree<'a>(style_node: &'a StyledNode<'a>) -> LayoutBox<'a> {
let mut root = LayoutBox::new(match style_node.display() {
Display::Block => BoxType::BlockNode(style_node),
Display::Inline => BoxType::InlineNode(style_node),
Display::None => BoxType::AnonymousBlock,
});
for child in &style_node.children {
match child.display() {
Display::Block => root.children.push(build_layout_tree(child)),
Display::Inline => root.children.push(build_layout_tree(child)),
Display::None => root.children.push(build_layout_tree(child)),
}
}
root
}
impl<'a> LayoutBox<'a> {
fn layout(&mut self, containing_block: Dimensions) {
match self.box_type {
BoxType::BlockNode(_) => self.layout_block(containing_block),
BoxType::InlineNode(_) => {}
BoxType::AnonymousBlock => {}
}
}
fn layout_block(&mut self, containing_block: Dimensions) {
self.calculate_block_width(containing_block);
self.calculate_block_position(containing_block);
self.layout_block_children();
self.calculate_block_height();
}
fn calculate_block_width(&mut self, containing_block: Dimensions) {
let style = self.get_style_node();
// 'width' initial value to 'auto'
let auto = css::Value::Keyword("auto".to_string());
let mut width = style.value("width").unwrap_or(auto.clone());
let zero = css::Value::Length(0.0, css::Unit::Px);
let mut margin_left = style.lookup("margin_left", "margin", &zero);
let mut margin_right = style.lookup("margin_right", "margin", &zero);
let border_left = style.lookup("border-left-width", "border-width", &zero);
let border_right = style.lookup("border-right-width", "border-width", &zero);
let padding_left = style.lookup("padding-left", "padding", &zero);
let padding_right = style.lookup("padding-right", "padding", &zero);
let total: f32 = [&margin_left, &margin_right, &padding_left, &padding_right, &border_left, &border_right, &width].iter().map(|v| v.to_px()).sum();
if width != auto && total > containing_block.content.width {
if margin_left == auto {
margin_left = css::Value::Length(0.0, css::Unit::Px);
}
if margin_right == auto {
margin_right = css::Value::Length(0.0, css::Unit::Px);
}
}
let underflow = containing_block.content.width - total;
match (width==auto, margin_left==auto, margin_right==auto) {
(false, false, false) => {
margin_right = Value::Length(margin_right.to_px()+underflow, Unit::Px);
}
(false, false, true) => {
margin_right = Value::Length(underflow, Unit::Px);
}
(false, true, false) => {
margin_left = Value::Length(underflow, Unit::Px);
}
(true, _, _,) => {
if margin_left == auto {margin_left = Value::Length(0.0, Unit::Px);}
if margin_right == auto {margin_right = Value::Length(0.0, Unit::Px);}
if underflow > 0.000001 {
width = Value::Length(underflow, Unit::Px);
} else {
width = Value::Length(underflow, Unit::Px);
}
}
(false, true, true) => {
margin_left = Value::Length(underflow/2.0, Unit::Px);
margin_right = Value::Length(underflow/2.0, Unit::Px);
}
}
}
fn calculate_block_height(&mut self) {
if let Some(Value::Length(h, Unit::Px)) = self.get_style_node().value("height") {
self.dimensions.content.height = h;
}
}
fn calculate_block_position(&mut self, containing_block: Dimensions) {
let style = self.get_style_node();
let d = &mut self.dimensions;
// margin, border, and padding have initial value 0.
let zero = Value::Length(0.0, Unit::Px);
// If margin-top or margin-bottom is `auto`, the used value is zero.
d.margin.top = style.lookup("margin-top", "margin", &zero).to_px();
d.margin.bottom = style.lookup("margin-bottom", "margin", &zero).to_px();
d.border.top = style.lookup("border-top-width", "border-width", &zero).to_px();
d.border.bottom = style.lookup("border-bottom-width", "border-width", &zero).to_px();
d.padding.top = style.lookup("padding-top", "padding", &zero).to_px();
d.padding.bottom = style.lookup("padding-bottom", "padding", &zero).to_px();
d.content.x = containing_block.content.x +
d.margin.left + d.border.left + d.padding.left;
// Position the box below all the previous boxes in the container.
d.content.y = containing_block.content.height + containing_block.content.y +
d.margin.top + d.border.top + d.padding.top;
}
fn layout_block_children(&mut self) {
let d = &mut self.dimensions;
for child in &mut self.children {
child.layout(*d);
// Track the height so each child is laid out below the previous content.
d.content.height = d.content.height + child.dimensions.margin_box().height;
}
}
}
|
/*use crate::data_set_parser::DataSetParser;
use crate::encoding::Encoding;
use crate::encoding::ImplicitLittleEndian;
use crate::handler::Handler;
use crate::meta_information;
use crate::meta_information::MetaInformation;
use crate::value_parser::ParseError;
use crate::value_parser::ParseResult;
#[derive(Debug, Default)]
pub struct P10Parser {
bytes_consumed: usize,
meta: Option<MetaInformation>,
parser: Option<Box<DataSetParser<dyn Encoding>>>,
}
impl P10Parser {
pub fn parse<'a, T: Handler>(
&mut self,
handler: &'a mut T,
bytes: &[u8],
) -> Result<ParseResult, ParseError> {
match self.meta {
None => {
let meta = meta_information::parse(handler, bytes)?;
self.meta = Some(meta);
self.bytes_consumed = meta.end_position;
self.parser = match &meta.transfer_syntax_uid[..] {
"1.2.840.10008.1.2" => {
Some(Box::new(DataSetParser::<ImplicitLittleEndian>::default()))
}
}
}
Some(_) => {}
}
println!("{:?}", self.meta);
Err(ParseError {
reason: "unexpected EOF",
position: self.bytes_consumed,
})
}
}
#[cfg(test)]
mod tests {
use super::P10Parser;
use crate::test::tests::read_file;
use crate::test::tests::TestHandler;
#[test]
fn explicit_little_endian() {
let bytes = read_file("tests/fixtures/CT1_UNC.explicit_little_endian.dcm");
let mut handler = TestHandler::default();
//handler.print = true;
let mut parser = P10Parser::default();
let result = parser.parse(&mut handler, &bytes);
assert!(result.is_ok());
assert_eq!(265, handler.attributes.len());
}
}
*/
|
use crate::{
error::Error,
model::{CreateUser, User},
};
use async_trait::async_trait;
#[async_trait]
pub trait Service: Sync + Send {
async fn create_user(&self, user: CreateUser) -> Result<User, Error>;
async fn list_users(&self) -> Result<Vec<User>, Error>;
async fn get_user(&self, id: i32) -> Result<Option<User>, Error>;
async fn delete_user(&self, id: i32) -> Result<bool, Error>;
}
|
#[derive(Debug, PartialEq)]
pub(crate) struct Flags {
pub(crate) zero: bool, // Zero - when arithmetic result is 0
pub(crate) sign: bool, // Sign - when the most significant bit is set
pub(crate) parity: bool, // Parity - when the answer has even parity
pub(crate) carry: bool, // Carry - when the instruction resulted in carry
pub(crate) zc: u8,
pub(crate) pad: u8,
}
impl Default for Flags {
fn default() -> Flags {
Flags {
zero: false,
sign: false,
parity: false,
carry: false,
zc: 0,
pad: 0,
}
}
}
impl Flags {
pub fn as_bits(&self) -> u8 {
let mut bits = 0;
if self.sign {
bits |= 0b1000_0000
}
if self.zero {
bits |= 0b0100_0000
}
if self.parity {
bits |= 0b0000_0100
}
if self.carry {
bits |= 0b0000_0001
}
bits
}
pub fn set(&mut self, byte: u8, carry: bool) -> () {
self.sign = (byte & 0x80) != 0;
self.zero = byte == 0u8;
self.parity = byte.count_ones() % 2 == 0;
self.carry = carry;
}
pub fn set_from_bits(&mut self, bits: u8) -> () {
self.sign = bits & 0b1000_0000 != 0;
self.zero = bits & 0b0100_0000 != 0;
self.parity = bits & 0b0000_0100 != 0;
self.carry = bits & 0b0000_0001 != 0;
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn as_bits_returns_correct_bits() {
let mut flags = Flags::default();
assert_eq!(flags.as_bits(), 0b0000_0000);
flags.carry = true;
assert_eq!(flags.as_bits(), 0b0000_0001);
flags.parity = true;
assert_eq!(flags.as_bits(), 0b0000_0101);
flags.zero = true;
assert_eq!(flags.as_bits(), 0b0100_0101);
flags.sign = true;
assert_eq!(flags.as_bits(), 0b1100_0101);
}
#[test]
fn set_sets_sign_flag() {
let mut flags = Flags::default();
let signed: u8 = 0b1000_0000;
flags.set(signed, false);
assert_eq!(flags.sign, true);
let unsigned: u8 = 0b0111_1111;
flags.set(unsigned, false);
assert_eq!(flags.sign, false);
}
#[test]
fn set_sets_carry_flag() {
let mut flags = Flags::default();
flags.set(0, true);
assert_eq!(flags.carry, true);
flags.set(0, false);
assert_eq!(flags.carry, false);
}
#[test]
fn set_sets_parity_flag() {
let mut flags = Flags::default();
let even1: u8 = 0b0000_0000;
let even2: u8 = 0b0110_0000;
let even3: u8 = 0b0001_1011;
flags.set(even1, false);
assert_eq!(flags.parity, true);
flags.set(even2, false);
assert_eq!(flags.parity, true);
flags.set(even3, false);
assert_eq!(flags.parity, true);
let odd1: u8 = 0b0000_0001;
let odd2: u8 = 0b0101_0001;
let odd3: u8 = 0b1011_0101;
flags.set(odd1, false);
assert_eq!(flags.parity, false);
flags.set(odd2, false);
assert_eq!(flags.parity, false);
flags.set(odd3, false);
assert_eq!(flags.parity, false);
}
#[test]
fn set_from_bits_sets_flags() {
let mut flags = Flags::default();
let sign = 0b1000_0000;
let zero = 0b0100_0000;
let parity = 0b0000_0100;
let carry = 0b0000_0001;
flags.set_from_bits(sign);
assert_eq!(flags.sign, true);
assert_eq!(flags.zero, false);
assert_eq!(flags.parity, false);
assert_eq!(flags.carry, false);
flags.set_from_bits(zero);
assert_eq!(flags.sign, false);
assert_eq!(flags.zero, true);
assert_eq!(flags.parity, false);
assert_eq!(flags.carry, false);
flags.set_from_bits(parity);
assert_eq!(flags.sign, false);
assert_eq!(flags.zero, false);
assert_eq!(flags.parity, true);
assert_eq!(flags.carry, false);
flags.set_from_bits(carry);
assert_eq!(flags.sign, false);
assert_eq!(flags.zero, false);
assert_eq!(flags.parity, false);
assert_eq!(flags.carry, true);
flags.set_from_bits(0b1111_1111);
assert_eq!(flags.sign, true);
assert_eq!(flags.zero, true);
assert_eq!(flags.parity, true);
assert_eq!(flags.carry, true);
}
}
|
//! Defines a structure to store the configuration of the exploration. The configuration
//! is read from the `Setting.toml` file if it exists. Some parameters can be overridden
//! from the command line.
extern crate toml;
use std::fs::File;
use std::io::{self, BufWriter, Write};
use std::path::{Path, PathBuf};
use std::{self, error, fmt, str::FromStr};
use config;
use log::warn;
use num_cpus;
use serde::{Deserialize, Serialize};
use utils::{tfrecord, unwrap};
use crate::explorer::eventlog::EventLog;
/// Stores the configuration of the exploration.
#[derive(Clone, Serialize, Deserialize)]
#[serde(default)]
#[serde(deny_unknown_fields)]
pub struct Config {
/// Path to the output directory to use. All other paths (e.g. `log_file`) are relative to
/// this directory. Defaults to the current working directory.
pub output_dir: String,
/// Name of the file in wich to store the logs.
pub log_file: String,
/// Name of the file in which to store the binary event log. If none is provided, the event
/// log is not saved.
pub event_log: Option<String>,
/// Number of exploration threads.
pub num_workers: usize,
/// Indicates the search must be stopped if a candidate with an execution time better
/// than the bound (in ns) is found.
pub stop_bound: Option<f64>,
/// If true, check all implementations found for correctness. Otherwise (the default) only the
/// best candidates are checked.
pub check_all: bool,
/// Indicates the search must be stopped after the given number of minutes.
pub timeout: Option<u64>,
/// Indicates the search must be stopped after the given number of
/// candidates have been evaluated.
pub max_evaluations: Option<usize>,
/// A percentage cut indicate that we only care to find a candidate that is in a
/// certain range above the best Therefore, if cut_under is 20%, we can discard any
/// candidate whose bound is above 80% of the current best.
pub distance_to_best: Option<f64>,
/// Restart the search every n evaluations.
///
/// Only supported by the MCTS search algorithm.
pub restart_every_n_evals: Option<usize>,
/// Exploration algorithm to use. Needs to be last for TOML serialization, because it is a table.
pub algorithm: SearchAlgorithm,
}
impl Config {
fn create_parser() -> config::Config {
let mut config_parser = config::Config::new();
// If there is nothing in the config, the parser fails by
// saying that it found a unit value where it expected a
// Config (see
// https://github.com/mehcode/config-rs/issues/60). As a
// workaround, we set an explicit default for the "timeout"
// option, which makes the parsing succeed even if there is
// nothing to parse.
unwrap!(config_parser.set_default::<Option<f64>>("timeout", None));
config_parser
}
/// Create a new configuration from the hardcoded `Settings.toml` configuration file if it
/// exists.
pub fn from_settings_toml() -> Self {
let settings_path = std::path::Path::new("Settings.toml");
if settings_path.exists() {
warn!("*** Loading config from Settings.toml ***");
warn!("*** Pay careful attention to the parameters used as they may differ from the defaults. ***");
unwrap!(Self::from_path(settings_path))
} else {
Self::default()
}
}
/// Extract the configuration from the given configuration file.
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, config::ConfigError> {
let mut parser = Self::create_parser();
parser.merge(config::File::from(path.as_ref()))?;
parser.try_into::<Self>()
}
/// Parse the configuration from a JSON string. Primary user is
/// the Python API (through the C API).
pub fn from_json(json: &str) -> Result<Self, config::ConfigError> {
let mut parser = Self::create_parser();
parser.merge(config::File::from_str(json, config::FileFormat::Json))?;
parser.try_into::<Self>()
}
pub fn output_path<P: AsRef<Path>>(&self, path: P) -> io::Result<PathBuf> {
let output_dir = Path::new(&self.output_dir);
// Ensure the output directory exists
std::fs::create_dir_all(output_dir)?;
Ok(output_dir.join(path))
}
pub fn create_log(&self) -> io::Result<BufWriter<File>> {
let mut f = File::create(self.output_path(&self.log_file)?)?;
writeln!(f, "LOGGER\n{}", self)?;
Ok(BufWriter::new(f))
}
pub fn create_eventlog(&self) -> io::Result<Option<tfrecord::Writer<EventLog>>> {
if let Some(event_log) = &self.event_log {
EventLog::create(self.output_path(event_log)?).map(Some)
} else {
Ok(None)
}
}
}
impl fmt::Display for Config {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", unwrap!(toml::to_string(self)))
}
}
impl Default for Config {
fn default() -> Self {
Config {
output_dir: ".".to_string(),
log_file: "watch.log".to_string(),
event_log: None,
check_all: false,
num_workers: num_cpus::get(),
algorithm: SearchAlgorithm::default(),
stop_bound: None,
timeout: None,
max_evaluations: None,
distance_to_best: None,
restart_every_n_evals: None,
}
}
}
/// Exploration algorithm to use.
#[derive(Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
pub enum SearchAlgorithm {
/// Evaluate all the candidates that cannot be pruned.
BoundOrder,
/// Use a MCTS algorithm
Mcts(BanditConfig),
}
impl Default for SearchAlgorithm {
fn default() -> Self {
SearchAlgorithm::Mcts(BanditConfig::default())
}
}
/// Configuration parameters specific to the multi-armed bandit algorithm.
#[derive(Clone, Serialize, Deserialize)]
#[serde(default)]
#[serde(deny_unknown_fields)]
pub struct BanditConfig {
/// Indicates the initial cut to use (in nanoseconds). This can be used when an existing
/// program (e.g. from a precedent run) is known to take that much amount of time.
pub initial_cut: Option<f64>,
/// Indicates whether we should backtrack locally when a dead-end is encountered. If false,
/// dead-ends will cause a restart from the root.
pub backtrack_deadends: bool,
/// Indicates how to select between nodes of the search tree when none of their
/// children have been evaluated.
pub new_nodes_order: NewNodeOrder,
/// Order in which the different choices are going to be determined
pub choice_ordering: ChoiceOrdering,
/// Indicates how to choose between nodes with at least one children evaluated.
pub tree_policy: TreePolicy,
}
/// Tree policy configuration
#[derive(Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
pub enum TreePolicy {
/// Take the candidate with the best bound.
Bound,
/// Consider the nodes with a probability proportional to the distance between the
/// cut and the bound.
WeightedRandom,
/// Policies based on TAG, as described in
///
/// Bandit-Based Optimization on Graphs with Application to Library Performance Tuning
/// De Mesmay, Rimmel, Voronenko, Püschel
/// ICML 2009
///
/// Those policies make decisions based on the relative proportions of the top N samples in
/// each branch, without relying directly on the values. This obviates the issue of selecting
/// a good threshold value for good vs bad samples (we don't know what a good value is until
/// after we have found it!), but introduces an issue with staleness:
#[serde(rename = "tag")]
TAG(TAGConfig),
/// Policies based on UCT, including variants such as p-UCT. Those policies optimize a reduced
/// value (such as average score or best score) among the samples seen in a branch, along with
/// an uncertainty term to boost rarely explored branches.
#[serde(rename = "uct")]
UCT(UCTConfig),
/// Always select the least visited child.
RoundRobin,
}
impl Default for TreePolicy {
fn default() -> Self {
TreePolicy::TAG(TAGConfig::default())
}
}
/// Configuration for the TAG algorithm
#[derive(Clone, Serialize, Deserialize)]
#[serde(default)]
#[serde(deny_unknown_fields)]
pub struct TAGConfig {
/// The number of best execution times to remember.
pub topk: usize,
/// The biggest delta is, the more focused on the previous best candidates the
/// exploration is.
pub delta: f64,
}
impl Default for TAGConfig {
fn default() -> Self {
TAGConfig {
topk: 10,
delta: 1.,
}
}
}
/// Configuration for the UCT algorithm
#[derive(Clone, Serialize, Deserialize)]
#[serde(default)]
#[serde(deny_unknown_fields)]
pub struct UCTConfig {
/// Constant multiplier for the exploration term. This is controls the
/// exploration-exploitation tradeoff, and is normalized using the `normalization` term.
pub exploration_constant: f64,
/// Normalization to use for the exploration term.
pub normalization: Option<Normalization>,
/// Reduction function to use when computing the state value.
pub value_reduction: ValueReduction,
/// Target to use as a reward.
pub reward: Reward,
/// Formula to use for the exploration term.
pub formula: Formula,
}
impl Default for UCTConfig {
fn default() -> Self {
UCTConfig {
exploration_constant: 2f64.sqrt(),
normalization: None,
// We use best value reduction by default because the mean value does not make much
// sense considering that we can have infinite/very large values due to both timeouts
// and cutting later in the evaluation process.
value_reduction: ValueReduction::Best,
reward: Reward::Speed,
formula: Formula::Uct,
}
}
}
#[derive(Copy, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Formula {
/// Regular UCT formula: sqrt(log(\sum visits) / visits)
Uct,
/// AlphaGo PUCT variant: p * sqrt(\sum visits) / visits
/// Currently only uniform prior is supported (p = 1 / k where k is the number of children).
AlphaPuct,
}
#[derive(Copy, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Reward {
NegTime,
Speed,
LogSpeed,
}
#[derive(Copy, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ValueReduction {
/// Use the mean evaluation time. This yields the regular UCT value function.
Mean,
/// Use the best evaluation time. This yields an algorithm similar to maxUCT from
///
/// Trial-based Heuristic Tree Search for Finite Horizon MDPs,
/// Thomas Keller and Malte Helmert
Best,
}
#[derive(Copy, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Normalization {
/// Normalize the exploration term according to the current global best.
GlobalBest,
}
impl Default for BanditConfig {
fn default() -> Self {
BanditConfig {
initial_cut: None,
new_nodes_order: NewNodeOrder::default(),
tree_policy: TreePolicy::default(),
choice_ordering: ChoiceOrdering::default(),
backtrack_deadends: false,
}
}
}
/// Indicates how to choose between nodes of the search tree when no children have been
/// evaluated.
#[derive(Clone, Copy, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum NewNodeOrder {
/// Consider the nodes in the order given by the search space API.
Api,
/// Consider the nodes in a random order.
Random,
/// Consider the nodes with the lowest bound first.
Bound,
/// Consider the nodes with a probability proportional to the distance between the
/// cut and the bound.
WeightedRandom,
}
impl Default for NewNodeOrder {
fn default() -> Self {
NewNodeOrder::WeightedRandom
}
}
/// An enum listing the Group of choices we can make
/// For example, we can make first all DimKind decisions, then all Order decisions, etc.
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum ChoiceGroup {
LowerLayout,
Size,
DimKind,
DimMap,
Order,
MemSpace,
InstFlag,
Threads,
ThreadSize,
/// Exposes choices from Order defining whether two dimension are
/// fused (explicitly sets Order::MERGED or explicitly eliminates
/// Order:MERGED)
DimFusion,
/// Exposes choices from Order defining whether two dimension are
/// nested (explicitly sets Order::INNER, Order::OUTER or
/// eliminates these two orders)
DimNesting,
}
impl fmt::Display for ChoiceGroup {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use self::ChoiceGroup::*;
f.write_str(match self {
LowerLayout => "lower_layout",
Size => "size",
DimKind => "dim_kind",
DimMap => "dim_map",
Order => "order",
MemSpace => "mem_space",
InstFlag => "inst_flag",
Threads => "threads",
ThreadSize => "thread_size",
DimFusion => "dim_fusion",
DimNesting => "dim_nesting",
})
}
}
/// An error which can be returned when parsing a group of choices.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ParseChoiceGroupError(String);
impl error::Error for ParseChoiceGroupError {}
impl fmt::Display for ParseChoiceGroupError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "invalid choice group value `{}`", self.0)
}
}
impl FromStr for ChoiceGroup {
type Err = ParseChoiceGroupError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use self::ChoiceGroup::*;
Ok(match s {
"lower_layout" => LowerLayout,
"size" => Size,
"dim_kind" => DimKind,
"dim_map" => DimMap,
"order" => Order,
"mem_space" => MemSpace,
"inst_flag" => InstFlag,
"threads" => Threads,
"thread_size" => ThreadSize,
"dim_fusion" => DimFusion,
"dim_nesting" => DimNesting,
_ => return Err(ParseChoiceGroupError(s.to_string())),
})
}
}
/// A list of ChoiceGroup representing the order in which we want to determine choices
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ChoiceOrdering(Vec<ChoiceGroup>);
impl<'a> IntoIterator for &'a ChoiceOrdering {
type Item = &'a ChoiceGroup;
type IntoIter = std::slice::Iter<'a, ChoiceGroup>;
fn into_iter(self) -> Self::IntoIter {
self.0.iter()
}
}
pub(super) const DEFAULT_ORDERING: [ChoiceGroup; 7] = [
ChoiceGroup::LowerLayout,
ChoiceGroup::Size,
ChoiceGroup::DimKind,
ChoiceGroup::DimMap,
ChoiceGroup::MemSpace,
ChoiceGroup::Order,
ChoiceGroup::InstFlag,
];
impl Default for ChoiceOrdering {
fn default() -> Self {
ChoiceOrdering(DEFAULT_ORDERING.to_vec())
}
}
impl fmt::Display for ChoiceOrdering {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some((first, rest)) = self.0.split_first() {
write!(f, "{:?}", first)?;
for elem in rest {
write!(f, ",{:?}", elem)?;
}
}
Ok(())
}
}
impl FromStr for ChoiceOrdering {
type Err = ParseChoiceGroupError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(ChoiceOrdering(
s.split(',')
.map(str::parse)
.collect::<Result<Vec<_>, _>>()?,
))
}
}
|
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
failure::{format_err, Error, ResultExt},
fidl_fuchsia_cobalt::{LoggerFactoryMarker, LoggerProxy, ReleaseStage},
fuchsia_async as fasync,
fuchsia_component::client::connect_to_service,
fuchsia_syslog as syslog, fuchsia_zircon as zx,
session_framework_metrics_registry::cobalt_registry::{self as metrics},
};
/// The name of the metrics project.
const PROJECT_NAME: &str = "session_framework";
/// Creates a LoggerProxy connected to Cobalt.
///
/// The connection is performed in a Future run on the global executor, but the `LoggerProxy`
/// can be used immediately.
///
/// # Returns
/// `LoggerProxy` for log messages to be sent to.
pub fn get_logger() -> Result<LoggerProxy, Error> {
let (logger_proxy, server_end) =
fidl::endpoints::create_proxy().context("Failed to create endpoints")?;
let logger_factory = connect_to_service::<LoggerFactoryMarker>()
.context("Failed to connect to the Cobalt LoggerFactory")?;
fasync::spawn(async move {
if let Err(e) = logger_factory
.create_logger_from_project_name(PROJECT_NAME, ReleaseStage::Debug, server_end)
.await
{
syslog::fx_log_err!("Failed to create Cobalt logger: {}", e);
}
});
Ok(logger_proxy)
}
/// Reports the time elapsed while launching a session.
///
/// # Parameters
/// - `logger_proxy`: The cobalt logger.
/// - `session_url`: The url of the session.
/// - `start_time`: The time when session_manager starts launching a session.
/// - `end_time`: The time when session_manager has bound to a session. This must be strictly after
/// `start_time`.
///
/// # Returns
/// `Ok` if the time elapsed was logged successfully.
pub async fn log_session_launch_time(
logger_proxy: LoggerProxy,
session_url: &str,
start_time: zx::Time,
end_time: zx::Time,
) -> Result<(), Error> {
let elapsed_time = (end_time - start_time).into_micros();
if elapsed_time < 0 {
return Err(format_err!("End time must be after start time."));
}
logger_proxy
.log_elapsed_time(
metrics::SESSION_LAUNCH_TIME_METRIC_ID,
metrics::SessionLaunchTimeMetricDimensionStatus::Success as u32,
&session_url,
elapsed_time,
)
.await
.context("Could not log session launch time.")?;
Ok(())
}
#[cfg(test)]
mod tests {
use {
super::*, fidl::endpoints::create_proxy_and_stream, fidl_fuchsia_cobalt::LoggerMarker,
futures::TryStreamExt,
};
/// Tests that the right payload is sent to Cobalt when logging the session launch time.
#[fasync::run_singlethreaded(test)]
async fn test_log_session_launch_time() {
let (logger_proxy, mut logger_server) =
create_proxy_and_stream::<LoggerMarker>().expect("Failed to create Logger FIDL.");
let start_time = zx::Time::from_nanos(0);
let end_time = zx::Time::from_nanos(5000);
let session_url = "fuchsia-pkg://fuchsia.com/whale_session#meta/whale_session.cm";
fasync::spawn(async move {
let _ = log_session_launch_time(logger_proxy, session_url, start_time, end_time).await;
});
if let Some(log_request) = logger_server.try_next().await.unwrap() {
if let fidl_fuchsia_cobalt::LoggerRequest::LogElapsedTime {
metric_id,
event_code,
component,
elapsed_micros,
responder: _,
} = log_request
{
assert_eq!(metric_id, metrics::SESSION_LAUNCH_TIME_METRIC_ID);
assert_eq!(
event_code,
metrics::SessionLaunchTimeMetricDimensionStatus::Success as u32
);
assert_eq!(component, session_url.to_string());
assert_eq!(elapsed_micros, 5);
} else {
assert!(false);
}
} else {
assert!(false);
}
}
#[fasync::run_singlethreaded(test)]
async fn test_log_session_launch_time_swap_start_end_time() {
let (logger_proxy, _logger_server) =
create_proxy_and_stream::<LoggerMarker>().expect("Failed to create Logger FIDL.");
let start_time = zx::Time::from_nanos(0);
let end_time = zx::Time::from_nanos(5000);
let session_url = "fuchsia-pkg://fuchsia.com/whale_session#meta/whale_session.cm";
assert!(log_session_launch_time(logger_proxy, session_url, end_time, start_time)
.await
.is_err());
}
}
|
use std::cmp::Ordering;
use ggez::graphics as ggraphics;
use ggez::input::mouse::MouseButton;
use crate::device::*;
use crate::numeric;
pub type Texture = ggraphics::Image;
pub trait DrawableComponent {
/// このトレイトを実装する場合、このメソッドには描画を行う処理を記述する
fn draw(&mut self, ctx: &mut ggez::Context) -> ggez::GameResult<()>;
/// このメソッドを呼び出した後は、
/// drawメソッドを呼び出しても何も描画されなくなることを保証しなければならない
/// appearメソッドが呼び出されれば、この効果は無効化されなければならない
fn hide(&mut self);
/// このメソッドを呼び出した後は、
/// hideメソッドを呼び出していた場合でも、drawメソッドで描画できることを保証しなければならない
/// hideメソッドが呼び出されれば、この効果は無効化されなければならない
fn appear(&mut self);
/// drawが有効ならtrue, そうでない場合はfalse
fn is_visible(&self) -> bool;
/// 描画順序を設定する
fn set_drawing_depth(&mut self, depth: i8);
/// 描画順序を返す
fn get_drawing_depth(&self) -> i8;
/// キー入力時の動作
fn virtual_key_event(
&mut self,
_ctx: &mut ggez::Context,
_event_type: KeyboardEvent,
_vkey: VirtualKey,
) {
// Nothing
}
/// マウスイベント時の動作
fn mouse_button_event(
&mut self,
_ctx: &mut ggez::Context,
_event_type: MouseButtonEvent,
_button: MouseButton,
_point: numeric::Point2f,
) {
// Nothing
}
}
///
/// # 基本的な描画処理を保証させるトレイト
/// 汎用的なdrawインターフェイスを提供する
///
pub trait DrawableObject: DrawableComponent {
/// 描画開始地点を設定する
fn set_position(&mut self, _pos: numeric::Point2f) {}
/// 描画開始地点を返す
fn get_position(&self) -> numeric::Point2f {
numeric::Point2f::new(0.0, 0.0)
}
/// offsetで指定しただけ描画位置を動かす
fn move_diff(&mut self, _offset: numeric::Vector2f) {}
}
///
/// DrawableObjectを深度(Z軸)でソートするための関数
///
/// この関数でソートすると、深度が深いものが先頭に来るようにソートされる
///
pub fn drawable_object_sort_with_depth<T, U>(a: &T, b: &U) -> Ordering
where
T: DrawableObject,
U: DrawableObject,
{
let (ad, bd) = (a.get_drawing_depth(), b.get_drawing_depth());
if ad > bd {
Ordering::Less
} else if ad < bd {
Ordering::Greater
} else {
Ordering::Equal
}
}
///
/// DrawableObjectを深度(Z軸)でソートするための関数
///
/// この関数でソートすると、深度が深いものが先頭に来るようにソートされる
///
pub fn boxed_drawable_object_sort_with_depth<T, U>(a: &Box<T>, b: &Box<U>) -> Ordering
where
T: DrawableObject,
U: DrawableObject,
{
let (ad, bd) = (a.get_drawing_depth(), b.get_drawing_depth());
if ad > bd {
Ordering::Less
} else if ad < bd {
Ordering::Greater
} else {
Ordering::Equal
}
}
///
/// # Trait DrawableObjectを実装するために必要なフィールド群
/// Trait DrawableObjectを実装する場合に便利な構造体
///
/// ## フィールド
/// ### visible
/// bool型
///
/// ### drawing_depth
/// i8型
///
#[derive(Clone)]
pub struct DrawableObjectEssential {
pub visible: bool,
pub drawing_depth: i8,
}
impl DrawableObjectEssential {
// DrawableObjectEssentialの生成関数
pub fn new(visible: bool, depth: i8) -> DrawableObjectEssential {
DrawableObjectEssential {
visible: visible,
drawing_depth: depth,
}
}
}
|
#[doc = "Reader of register MDIER"]
pub type R = crate::R<u32, super::MDIER>;
#[doc = "Writer for register MDIER"]
pub type W = crate::W<u32, super::MDIER>;
#[doc = "Register MDIER `reset()`'s with value 0"]
impl crate::ResetValue for super::MDIER {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `MUPDDE`"]
pub type MUPDDE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MUPDDE`"]
pub struct MUPDDE_W<'a> {
w: &'a mut W,
}
impl<'a> MUPDDE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 22)) | (((value as u32) & 0x01) << 22);
self.w
}
}
#[doc = "Reader of field `SYNCDE`"]
pub type SYNCDE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SYNCDE`"]
pub struct SYNCDE_W<'a> {
w: &'a mut W,
}
impl<'a> SYNCDE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 21)) | (((value as u32) & 0x01) << 21);
self.w
}
}
#[doc = "Reader of field `MREPDE`"]
pub type MREPDE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MREPDE`"]
pub struct MREPDE_W<'a> {
w: &'a mut W,
}
impl<'a> MREPDE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20);
self.w
}
}
#[doc = "Reader of field `MCMP4DE`"]
pub type MCMP4DE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MCMP4DE`"]
pub struct MCMP4DE_W<'a> {
w: &'a mut W,
}
impl<'a> MCMP4DE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 19)) | (((value as u32) & 0x01) << 19);
self.w
}
}
#[doc = "Reader of field `MCMP3DE`"]
pub type MCMP3DE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MCMP3DE`"]
pub struct MCMP3DE_W<'a> {
w: &'a mut W,
}
impl<'a> MCMP3DE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18);
self.w
}
}
#[doc = "Reader of field `MCMP2DE`"]
pub type MCMP2DE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MCMP2DE`"]
pub struct MCMP2DE_W<'a> {
w: &'a mut W,
}
impl<'a> MCMP2DE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17);
self.w
}
}
#[doc = "Reader of field `MCMP1DE`"]
pub type MCMP1DE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MCMP1DE`"]
pub struct MCMP1DE_W<'a> {
w: &'a mut W,
}
impl<'a> MCMP1DE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
self.w
}
}
#[doc = "Reader of field `MUPDIE`"]
pub type MUPDIE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MUPDIE`"]
pub struct MUPDIE_W<'a> {
w: &'a mut W,
}
impl<'a> MUPDIE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
self.w
}
}
#[doc = "Reader of field `SYNCIE`"]
pub type SYNCIE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SYNCIE`"]
pub struct SYNCIE_W<'a> {
w: &'a mut W,
}
impl<'a> SYNCIE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
self.w
}
}
#[doc = "Reader of field `MREPIE`"]
pub type MREPIE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MREPIE`"]
pub struct MREPIE_W<'a> {
w: &'a mut W,
}
impl<'a> MREPIE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
self.w
}
}
#[doc = "Reader of field `MCMP4IE`"]
pub type MCMP4IE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MCMP4IE`"]
pub struct MCMP4IE_W<'a> {
w: &'a mut W,
}
impl<'a> MCMP4IE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
self.w
}
}
#[doc = "Reader of field `MCMP3IE`"]
pub type MCMP3IE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MCMP3IE`"]
pub struct MCMP3IE_W<'a> {
w: &'a mut W,
}
impl<'a> MCMP3IE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
self.w
}
}
#[doc = "Reader of field `MCMP2IE`"]
pub type MCMP2IE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MCMP2IE`"]
pub struct MCMP2IE_W<'a> {
w: &'a mut W,
}
impl<'a> MCMP2IE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
self.w
}
}
#[doc = "Reader of field `MCMP1IE`"]
pub type MCMP1IE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MCMP1IE`"]
pub struct MCMP1IE_W<'a> {
w: &'a mut W,
}
impl<'a> MCMP1IE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
self.w
}
}
impl R {
#[doc = "Bit 22 - MUPDDE"]
#[inline(always)]
pub fn mupdde(&self) -> MUPDDE_R {
MUPDDE_R::new(((self.bits >> 22) & 0x01) != 0)
}
#[doc = "Bit 21 - SYNCDE"]
#[inline(always)]
pub fn syncde(&self) -> SYNCDE_R {
SYNCDE_R::new(((self.bits >> 21) & 0x01) != 0)
}
#[doc = "Bit 20 - MREPDE"]
#[inline(always)]
pub fn mrepde(&self) -> MREPDE_R {
MREPDE_R::new(((self.bits >> 20) & 0x01) != 0)
}
#[doc = "Bit 19 - MCMP4DE"]
#[inline(always)]
pub fn mcmp4de(&self) -> MCMP4DE_R {
MCMP4DE_R::new(((self.bits >> 19) & 0x01) != 0)
}
#[doc = "Bit 18 - MCMP3DE"]
#[inline(always)]
pub fn mcmp3de(&self) -> MCMP3DE_R {
MCMP3DE_R::new(((self.bits >> 18) & 0x01) != 0)
}
#[doc = "Bit 17 - MCMP2DE"]
#[inline(always)]
pub fn mcmp2de(&self) -> MCMP2DE_R {
MCMP2DE_R::new(((self.bits >> 17) & 0x01) != 0)
}
#[doc = "Bit 16 - MCMP1DE"]
#[inline(always)]
pub fn mcmp1de(&self) -> MCMP1DE_R {
MCMP1DE_R::new(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 6 - MUPDIE"]
#[inline(always)]
pub fn mupdie(&self) -> MUPDIE_R {
MUPDIE_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 5 - SYNCIE"]
#[inline(always)]
pub fn syncie(&self) -> SYNCIE_R {
SYNCIE_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 4 - MREPIE"]
#[inline(always)]
pub fn mrepie(&self) -> MREPIE_R {
MREPIE_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 3 - MCMP4IE"]
#[inline(always)]
pub fn mcmp4ie(&self) -> MCMP4IE_R {
MCMP4IE_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 2 - MCMP3IE"]
#[inline(always)]
pub fn mcmp3ie(&self) -> MCMP3IE_R {
MCMP3IE_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - MCMP2IE"]
#[inline(always)]
pub fn mcmp2ie(&self) -> MCMP2IE_R {
MCMP2IE_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - MCMP1IE"]
#[inline(always)]
pub fn mcmp1ie(&self) -> MCMP1IE_R {
MCMP1IE_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 22 - MUPDDE"]
#[inline(always)]
pub fn mupdde(&mut self) -> MUPDDE_W {
MUPDDE_W { w: self }
}
#[doc = "Bit 21 - SYNCDE"]
#[inline(always)]
pub fn syncde(&mut self) -> SYNCDE_W {
SYNCDE_W { w: self }
}
#[doc = "Bit 20 - MREPDE"]
#[inline(always)]
pub fn mrepde(&mut self) -> MREPDE_W {
MREPDE_W { w: self }
}
#[doc = "Bit 19 - MCMP4DE"]
#[inline(always)]
pub fn mcmp4de(&mut self) -> MCMP4DE_W {
MCMP4DE_W { w: self }
}
#[doc = "Bit 18 - MCMP3DE"]
#[inline(always)]
pub fn mcmp3de(&mut self) -> MCMP3DE_W {
MCMP3DE_W { w: self }
}
#[doc = "Bit 17 - MCMP2DE"]
#[inline(always)]
pub fn mcmp2de(&mut self) -> MCMP2DE_W {
MCMP2DE_W { w: self }
}
#[doc = "Bit 16 - MCMP1DE"]
#[inline(always)]
pub fn mcmp1de(&mut self) -> MCMP1DE_W {
MCMP1DE_W { w: self }
}
#[doc = "Bit 6 - MUPDIE"]
#[inline(always)]
pub fn mupdie(&mut self) -> MUPDIE_W {
MUPDIE_W { w: self }
}
#[doc = "Bit 5 - SYNCIE"]
#[inline(always)]
pub fn syncie(&mut self) -> SYNCIE_W {
SYNCIE_W { w: self }
}
#[doc = "Bit 4 - MREPIE"]
#[inline(always)]
pub fn mrepie(&mut self) -> MREPIE_W {
MREPIE_W { w: self }
}
#[doc = "Bit 3 - MCMP4IE"]
#[inline(always)]
pub fn mcmp4ie(&mut self) -> MCMP4IE_W {
MCMP4IE_W { w: self }
}
#[doc = "Bit 2 - MCMP3IE"]
#[inline(always)]
pub fn mcmp3ie(&mut self) -> MCMP3IE_W {
MCMP3IE_W { w: self }
}
#[doc = "Bit 1 - MCMP2IE"]
#[inline(always)]
pub fn mcmp2ie(&mut self) -> MCMP2IE_W {
MCMP2IE_W { w: self }
}
#[doc = "Bit 0 - MCMP1IE"]
#[inline(always)]
pub fn mcmp1ie(&mut self) -> MCMP1IE_W {
MCMP1IE_W { w: self }
}
}
|
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtGui/qabstracttextdocumentlayout.h
// dst-file: /src/gui/qabstracttextdocumentlayout.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
// <= main block end
// use block begin =>
use std::ops::Deref;
use super::qtextdocument::*; // 773
use super::qtextformat::*; // 773
use super::super::core::qsize::*; // 771
use super::qpainter::*; // 773
use super::super::core::qrect::*; // 771
use super::super::core::qobject::*; // 771
use super::super::core::qobjectdefs::*; // 771
use super::super::core::qpoint::*; // 771
use super::qpaintdevice::*; // 773
use super::super::core::qstring::*; // 771
// use super::qabstracttextdocumentlayout::QTextObjectInterface; // 773
use super::qtextobject::*; // 773
// <= use block end
// ext block begin =>
// #[link(name = "Qt5Core")]
// #[link(name = "Qt5Gui")]
// #[link(name = "Qt5Widgets")]
// #[link(name = "QtInline")]
extern {
fn QTextObjectInterface_Class_Size() -> c_int;
// proto: void QTextObjectInterface::~QTextObjectInterface();
fn C_ZN20QTextObjectInterfaceD2Ev(qthis: u64 /* *mut c_void*/);
// proto: QSizeF QTextObjectInterface::intrinsicSize(QTextDocument * doc, int posInDocument, const QTextFormat & format);
fn C_ZN20QTextObjectInterface13intrinsicSizeEP13QTextDocumentiRK11QTextFormat(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int, arg2: *mut c_void) -> *mut c_void;
// proto: void QTextObjectInterface::drawObject(QPainter * painter, const QRectF & rect, QTextDocument * doc, int posInDocument, const QTextFormat & format);
fn C_ZN20QTextObjectInterface10drawObjectEP8QPainterRK6QRectFP13QTextDocumentiRK11QTextFormat(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void, arg3: c_int, arg4: *mut c_void);
fn QAbstractTextDocumentLayout_Class_Size() -> c_int;
// proto: const QMetaObject * QAbstractTextDocumentLayout::metaObject();
fn C_ZNK27QAbstractTextDocumentLayout10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QAbstractTextDocumentLayout::registerHandler(int objectType, QObject * component);
fn C_ZN27QAbstractTextDocumentLayout15registerHandlerEiP7QObject(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void);
// proto: int QAbstractTextDocumentLayout::pageCount();
fn C_ZNK27QAbstractTextDocumentLayout9pageCountEv(qthis: u64 /* *mut c_void*/) -> c_int;
// proto: void QAbstractTextDocumentLayout::~QAbstractTextDocumentLayout();
fn C_ZN27QAbstractTextDocumentLayoutD2Ev(qthis: u64 /* *mut c_void*/);
// proto: void QAbstractTextDocumentLayout::setPaintDevice(QPaintDevice * device);
fn C_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: QTextDocument * QAbstractTextDocumentLayout::document();
fn C_ZNK27QAbstractTextDocumentLayout8documentEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QAbstractTextDocumentLayout::unregisterHandler(int objectType, QObject * component);
fn C_ZN27QAbstractTextDocumentLayout17unregisterHandlerEiP7QObject(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void);
// proto: void QAbstractTextDocumentLayout::QAbstractTextDocumentLayout(QTextDocument * doc);
fn C_ZN27QAbstractTextDocumentLayoutC2EP13QTextDocument(arg0: *mut c_void) -> u64;
// proto: QSizeF QAbstractTextDocumentLayout::documentSize();
fn C_ZNK27QAbstractTextDocumentLayout12documentSizeEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: QPaintDevice * QAbstractTextDocumentLayout::paintDevice();
fn C_ZNK27QAbstractTextDocumentLayout11paintDeviceEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: QString QAbstractTextDocumentLayout::anchorAt(const QPointF & pos);
fn C_ZNK27QAbstractTextDocumentLayout8anchorAtERK7QPointF(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void;
// proto: QTextObjectInterface * QAbstractTextDocumentLayout::handlerForObject(int objectType);
fn C_ZNK27QAbstractTextDocumentLayout16handlerForObjectEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void;
// proto: QRectF QAbstractTextDocumentLayout::frameBoundingRect(QTextFrame * frame);
fn C_ZNK27QAbstractTextDocumentLayout17frameBoundingRectEP10QTextFrame(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void;
// proto: QRectF QAbstractTextDocumentLayout::blockBoundingRect(const QTextBlock & block);
fn C_ZNK27QAbstractTextDocumentLayout17blockBoundingRectERK10QTextBlock(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void;
fn QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout16pageCountChangedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout19documentSizeChangedERK6QSizeF(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout11updateBlockERK10QTextBlock(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
} // <= ext block end
// body block begin =>
// class sizeof(QTextObjectInterface)=8
#[derive(Default)]
pub struct QTextObjectInterface {
// qbase: None,
pub qclsinst: u64 /* *mut c_void*/,
}
// class sizeof(QAbstractTextDocumentLayout)=1
#[derive(Default)]
pub struct QAbstractTextDocumentLayout {
qbase: QObject,
pub qclsinst: u64 /* *mut c_void*/,
pub _updateBlock: QAbstractTextDocumentLayout_updateBlock_signal,
pub _pageCountChanged: QAbstractTextDocumentLayout_pageCountChanged_signal,
pub _update: QAbstractTextDocumentLayout_update_signal,
pub _documentSizeChanged: QAbstractTextDocumentLayout_documentSizeChanged_signal,
}
impl /*struct*/ QTextObjectInterface {
pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QTextObjectInterface {
return QTextObjectInterface{qclsinst: qthis, ..Default::default()};
}
}
// proto: void QTextObjectInterface::~QTextObjectInterface();
impl /*struct*/ QTextObjectInterface {
pub fn free<RetType, T: QTextObjectInterface_free<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.free(self);
// return 1;
}
}
pub trait QTextObjectInterface_free<RetType> {
fn free(self , rsthis: & QTextObjectInterface) -> RetType;
}
// proto: void QTextObjectInterface::~QTextObjectInterface();
impl<'a> /*trait*/ QTextObjectInterface_free<()> for () {
fn free(self , rsthis: & QTextObjectInterface) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN20QTextObjectInterfaceD2Ev()};
unsafe {C_ZN20QTextObjectInterfaceD2Ev(rsthis.qclsinst)};
// return 1;
}
}
// proto: QSizeF QTextObjectInterface::intrinsicSize(QTextDocument * doc, int posInDocument, const QTextFormat & format);
impl /*struct*/ QTextObjectInterface {
pub fn intrinsicSize<RetType, T: QTextObjectInterface_intrinsicSize<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.intrinsicSize(self);
// return 1;
}
}
pub trait QTextObjectInterface_intrinsicSize<RetType> {
fn intrinsicSize(self , rsthis: & QTextObjectInterface) -> RetType;
}
// proto: QSizeF QTextObjectInterface::intrinsicSize(QTextDocument * doc, int posInDocument, const QTextFormat & format);
impl<'a> /*trait*/ QTextObjectInterface_intrinsicSize<QSizeF> for (&'a QTextDocument, i32, &'a QTextFormat) {
fn intrinsicSize(self , rsthis: & QTextObjectInterface) -> QSizeF {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN20QTextObjectInterface13intrinsicSizeEP13QTextDocumentiRK11QTextFormat()};
let arg0 = self.0.qclsinst as *mut c_void;
let arg1 = self.1 as c_int;
let arg2 = self.2.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZN20QTextObjectInterface13intrinsicSizeEP13QTextDocumentiRK11QTextFormat(rsthis.qclsinst, arg0, arg1, arg2)};
let mut ret1 = QSizeF::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QTextObjectInterface::drawObject(QPainter * painter, const QRectF & rect, QTextDocument * doc, int posInDocument, const QTextFormat & format);
impl /*struct*/ QTextObjectInterface {
pub fn drawObject<RetType, T: QTextObjectInterface_drawObject<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.drawObject(self);
// return 1;
}
}
pub trait QTextObjectInterface_drawObject<RetType> {
fn drawObject(self , rsthis: & QTextObjectInterface) -> RetType;
}
// proto: void QTextObjectInterface::drawObject(QPainter * painter, const QRectF & rect, QTextDocument * doc, int posInDocument, const QTextFormat & format);
impl<'a> /*trait*/ QTextObjectInterface_drawObject<()> for (&'a QPainter, &'a QRectF, &'a QTextDocument, i32, &'a QTextFormat) {
fn drawObject(self , rsthis: & QTextObjectInterface) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN20QTextObjectInterface10drawObjectEP8QPainterRK6QRectFP13QTextDocumentiRK11QTextFormat()};
let arg0 = self.0.qclsinst as *mut c_void;
let arg1 = self.1.qclsinst as *mut c_void;
let arg2 = self.2.qclsinst as *mut c_void;
let arg3 = self.3 as c_int;
let arg4 = self.4.qclsinst as *mut c_void;
unsafe {C_ZN20QTextObjectInterface10drawObjectEP8QPainterRK6QRectFP13QTextDocumentiRK11QTextFormat(rsthis.qclsinst, arg0, arg1, arg2, arg3, arg4)};
// return 1;
}
}
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QAbstractTextDocumentLayout {
return QAbstractTextDocumentLayout{qbase: QObject::inheritFrom(qthis), qclsinst: qthis, ..Default::default()};
}
}
impl Deref for QAbstractTextDocumentLayout {
type Target = QObject;
fn deref(&self) -> &QObject {
return & self.qbase;
}
}
impl AsRef<QObject> for QAbstractTextDocumentLayout {
fn as_ref(& self) -> & QObject {
return & self.qbase;
}
}
// proto: const QMetaObject * QAbstractTextDocumentLayout::metaObject();
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn metaObject<RetType, T: QAbstractTextDocumentLayout_metaObject<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.metaObject(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_metaObject<RetType> {
fn metaObject(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: const QMetaObject * QAbstractTextDocumentLayout::metaObject();
impl<'a> /*trait*/ QAbstractTextDocumentLayout_metaObject<QMetaObject> for () {
fn metaObject(self , rsthis: & QAbstractTextDocumentLayout) -> QMetaObject {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout10metaObjectEv()};
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout10metaObjectEv(rsthis.qclsinst)};
let mut ret1 = QMetaObject::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractTextDocumentLayout::registerHandler(int objectType, QObject * component);
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn registerHandler<RetType, T: QAbstractTextDocumentLayout_registerHandler<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.registerHandler(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_registerHandler<RetType> {
fn registerHandler(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: void QAbstractTextDocumentLayout::registerHandler(int objectType, QObject * component);
impl<'a> /*trait*/ QAbstractTextDocumentLayout_registerHandler<()> for (i32, &'a QObject) {
fn registerHandler(self , rsthis: & QAbstractTextDocumentLayout) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN27QAbstractTextDocumentLayout15registerHandlerEiP7QObject()};
let arg0 = self.0 as c_int;
let arg1 = self.1.qclsinst as *mut c_void;
unsafe {C_ZN27QAbstractTextDocumentLayout15registerHandlerEiP7QObject(rsthis.qclsinst, arg0, arg1)};
// return 1;
}
}
// proto: int QAbstractTextDocumentLayout::pageCount();
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn pageCount<RetType, T: QAbstractTextDocumentLayout_pageCount<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.pageCount(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_pageCount<RetType> {
fn pageCount(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: int QAbstractTextDocumentLayout::pageCount();
impl<'a> /*trait*/ QAbstractTextDocumentLayout_pageCount<i32> for () {
fn pageCount(self , rsthis: & QAbstractTextDocumentLayout) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout9pageCountEv()};
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout9pageCountEv(rsthis.qclsinst)};
return ret as i32; // 1
// return 1;
}
}
// proto: void QAbstractTextDocumentLayout::~QAbstractTextDocumentLayout();
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn free<RetType, T: QAbstractTextDocumentLayout_free<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.free(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_free<RetType> {
fn free(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: void QAbstractTextDocumentLayout::~QAbstractTextDocumentLayout();
impl<'a> /*trait*/ QAbstractTextDocumentLayout_free<()> for () {
fn free(self , rsthis: & QAbstractTextDocumentLayout) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN27QAbstractTextDocumentLayoutD2Ev()};
unsafe {C_ZN27QAbstractTextDocumentLayoutD2Ev(rsthis.qclsinst)};
// return 1;
}
}
// proto: void QAbstractTextDocumentLayout::setPaintDevice(QPaintDevice * device);
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn setPaintDevice<RetType, T: QAbstractTextDocumentLayout_setPaintDevice<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setPaintDevice(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_setPaintDevice<RetType> {
fn setPaintDevice(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: void QAbstractTextDocumentLayout::setPaintDevice(QPaintDevice * device);
impl<'a> /*trait*/ QAbstractTextDocumentLayout_setPaintDevice<()> for (&'a QPaintDevice) {
fn setPaintDevice(self , rsthis: & QAbstractTextDocumentLayout) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QTextDocument * QAbstractTextDocumentLayout::document();
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn document<RetType, T: QAbstractTextDocumentLayout_document<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.document(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_document<RetType> {
fn document(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: QTextDocument * QAbstractTextDocumentLayout::document();
impl<'a> /*trait*/ QAbstractTextDocumentLayout_document<QTextDocument> for () {
fn document(self , rsthis: & QAbstractTextDocumentLayout) -> QTextDocument {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout8documentEv()};
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout8documentEv(rsthis.qclsinst)};
let mut ret1 = QTextDocument::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QAbstractTextDocumentLayout::unregisterHandler(int objectType, QObject * component);
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn unregisterHandler<RetType, T: QAbstractTextDocumentLayout_unregisterHandler<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.unregisterHandler(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_unregisterHandler<RetType> {
fn unregisterHandler(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: void QAbstractTextDocumentLayout::unregisterHandler(int objectType, QObject * component);
impl<'a> /*trait*/ QAbstractTextDocumentLayout_unregisterHandler<()> for (i32, Option<&'a QObject>) {
fn unregisterHandler(self , rsthis: & QAbstractTextDocumentLayout) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN27QAbstractTextDocumentLayout17unregisterHandlerEiP7QObject()};
let arg0 = self.0 as c_int;
let arg1 = (if self.1.is_none() {0} else {self.1.unwrap().qclsinst}) as *mut c_void;
unsafe {C_ZN27QAbstractTextDocumentLayout17unregisterHandlerEiP7QObject(rsthis.qclsinst, arg0, arg1)};
// return 1;
}
}
// proto: void QAbstractTextDocumentLayout::QAbstractTextDocumentLayout(QTextDocument * doc);
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn new<T: QAbstractTextDocumentLayout_new>(value: T) -> QAbstractTextDocumentLayout {
let rsthis = value.new();
return rsthis;
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_new {
fn new(self) -> QAbstractTextDocumentLayout;
}
// proto: void QAbstractTextDocumentLayout::QAbstractTextDocumentLayout(QTextDocument * doc);
impl<'a> /*trait*/ QAbstractTextDocumentLayout_new for (&'a QTextDocument) {
fn new(self) -> QAbstractTextDocumentLayout {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN27QAbstractTextDocumentLayoutC2EP13QTextDocument()};
let ctysz: c_int = unsafe{QAbstractTextDocumentLayout_Class_Size()};
let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64;
let arg0 = self.qclsinst as *mut c_void;
let qthis: u64 = unsafe {C_ZN27QAbstractTextDocumentLayoutC2EP13QTextDocument(arg0)};
let rsthis = QAbstractTextDocumentLayout{qbase: QObject::inheritFrom(qthis), qclsinst: qthis, ..Default::default()};
return rsthis;
// return 1;
}
}
// proto: QSizeF QAbstractTextDocumentLayout::documentSize();
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn documentSize<RetType, T: QAbstractTextDocumentLayout_documentSize<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.documentSize(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_documentSize<RetType> {
fn documentSize(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: QSizeF QAbstractTextDocumentLayout::documentSize();
impl<'a> /*trait*/ QAbstractTextDocumentLayout_documentSize<QSizeF> for () {
fn documentSize(self , rsthis: & QAbstractTextDocumentLayout) -> QSizeF {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout12documentSizeEv()};
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout12documentSizeEv(rsthis.qclsinst)};
let mut ret1 = QSizeF::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QPaintDevice * QAbstractTextDocumentLayout::paintDevice();
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn paintDevice<RetType, T: QAbstractTextDocumentLayout_paintDevice<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.paintDevice(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_paintDevice<RetType> {
fn paintDevice(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: QPaintDevice * QAbstractTextDocumentLayout::paintDevice();
impl<'a> /*trait*/ QAbstractTextDocumentLayout_paintDevice<QPaintDevice> for () {
fn paintDevice(self , rsthis: & QAbstractTextDocumentLayout) -> QPaintDevice {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout11paintDeviceEv()};
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout11paintDeviceEv(rsthis.qclsinst)};
let mut ret1 = QPaintDevice::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QString QAbstractTextDocumentLayout::anchorAt(const QPointF & pos);
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn anchorAt<RetType, T: QAbstractTextDocumentLayout_anchorAt<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.anchorAt(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_anchorAt<RetType> {
fn anchorAt(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: QString QAbstractTextDocumentLayout::anchorAt(const QPointF & pos);
impl<'a> /*trait*/ QAbstractTextDocumentLayout_anchorAt<QString> for (&'a QPointF) {
fn anchorAt(self , rsthis: & QAbstractTextDocumentLayout) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout8anchorAtERK7QPointF()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout8anchorAtERK7QPointF(rsthis.qclsinst, arg0)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QTextObjectInterface * QAbstractTextDocumentLayout::handlerForObject(int objectType);
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn handlerForObject<RetType, T: QAbstractTextDocumentLayout_handlerForObject<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.handlerForObject(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_handlerForObject<RetType> {
fn handlerForObject(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: QTextObjectInterface * QAbstractTextDocumentLayout::handlerForObject(int objectType);
impl<'a> /*trait*/ QAbstractTextDocumentLayout_handlerForObject<QTextObjectInterface> for (i32) {
fn handlerForObject(self , rsthis: & QAbstractTextDocumentLayout) -> QTextObjectInterface {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout16handlerForObjectEi()};
let arg0 = self as c_int;
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout16handlerForObjectEi(rsthis.qclsinst, arg0)};
let mut ret1 = QTextObjectInterface::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QRectF QAbstractTextDocumentLayout::frameBoundingRect(QTextFrame * frame);
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn frameBoundingRect<RetType, T: QAbstractTextDocumentLayout_frameBoundingRect<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.frameBoundingRect(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_frameBoundingRect<RetType> {
fn frameBoundingRect(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: QRectF QAbstractTextDocumentLayout::frameBoundingRect(QTextFrame * frame);
impl<'a> /*trait*/ QAbstractTextDocumentLayout_frameBoundingRect<QRectF> for (&'a QTextFrame) {
fn frameBoundingRect(self , rsthis: & QAbstractTextDocumentLayout) -> QRectF {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout17frameBoundingRectEP10QTextFrame()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout17frameBoundingRectEP10QTextFrame(rsthis.qclsinst, arg0)};
let mut ret1 = QRectF::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QRectF QAbstractTextDocumentLayout::blockBoundingRect(const QTextBlock & block);
impl /*struct*/ QAbstractTextDocumentLayout {
pub fn blockBoundingRect<RetType, T: QAbstractTextDocumentLayout_blockBoundingRect<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.blockBoundingRect(self);
// return 1;
}
}
pub trait QAbstractTextDocumentLayout_blockBoundingRect<RetType> {
fn blockBoundingRect(self , rsthis: & QAbstractTextDocumentLayout) -> RetType;
}
// proto: QRectF QAbstractTextDocumentLayout::blockBoundingRect(const QTextBlock & block);
impl<'a> /*trait*/ QAbstractTextDocumentLayout_blockBoundingRect<QRectF> for (&'a QTextBlock) {
fn blockBoundingRect(self , rsthis: & QAbstractTextDocumentLayout) -> QRectF {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK27QAbstractTextDocumentLayout17blockBoundingRectERK10QTextBlock()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK27QAbstractTextDocumentLayout17blockBoundingRectERK10QTextBlock(rsthis.qclsinst, arg0)};
let mut ret1 = QRectF::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
#[derive(Default)] // for QAbstractTextDocumentLayout_updateBlock
pub struct QAbstractTextDocumentLayout_updateBlock_signal{poi:u64}
impl /* struct */ QAbstractTextDocumentLayout {
pub fn updateBlock(&self) -> QAbstractTextDocumentLayout_updateBlock_signal {
return QAbstractTextDocumentLayout_updateBlock_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractTextDocumentLayout_updateBlock_signal {
pub fn connect<T: QAbstractTextDocumentLayout_updateBlock_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractTextDocumentLayout_updateBlock_signal_connect {
fn connect(self, sigthis: QAbstractTextDocumentLayout_updateBlock_signal);
}
#[derive(Default)] // for QAbstractTextDocumentLayout_pageCountChanged
pub struct QAbstractTextDocumentLayout_pageCountChanged_signal{poi:u64}
impl /* struct */ QAbstractTextDocumentLayout {
pub fn pageCountChanged(&self) -> QAbstractTextDocumentLayout_pageCountChanged_signal {
return QAbstractTextDocumentLayout_pageCountChanged_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractTextDocumentLayout_pageCountChanged_signal {
pub fn connect<T: QAbstractTextDocumentLayout_pageCountChanged_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractTextDocumentLayout_pageCountChanged_signal_connect {
fn connect(self, sigthis: QAbstractTextDocumentLayout_pageCountChanged_signal);
}
#[derive(Default)] // for QAbstractTextDocumentLayout_update
pub struct QAbstractTextDocumentLayout_update_signal{poi:u64}
impl /* struct */ QAbstractTextDocumentLayout {
pub fn update(&self) -> QAbstractTextDocumentLayout_update_signal {
return QAbstractTextDocumentLayout_update_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractTextDocumentLayout_update_signal {
pub fn connect<T: QAbstractTextDocumentLayout_update_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractTextDocumentLayout_update_signal_connect {
fn connect(self, sigthis: QAbstractTextDocumentLayout_update_signal);
}
#[derive(Default)] // for QAbstractTextDocumentLayout_documentSizeChanged
pub struct QAbstractTextDocumentLayout_documentSizeChanged_signal{poi:u64}
impl /* struct */ QAbstractTextDocumentLayout {
pub fn documentSizeChanged(&self) -> QAbstractTextDocumentLayout_documentSizeChanged_signal {
return QAbstractTextDocumentLayout_documentSizeChanged_signal{poi:self.qclsinst};
}
}
impl /* struct */ QAbstractTextDocumentLayout_documentSizeChanged_signal {
pub fn connect<T: QAbstractTextDocumentLayout_documentSizeChanged_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QAbstractTextDocumentLayout_documentSizeChanged_signal_connect {
fn connect(self, sigthis: QAbstractTextDocumentLayout_documentSizeChanged_signal);
}
// pageCountChanged(int)
extern fn QAbstractTextDocumentLayout_pageCountChanged_signal_connect_cb_0(rsfptr:fn(i32), arg0: c_int) {
println!("{}:{}", file!(), line!());
let rsarg0 = arg0 as i32;
rsfptr(rsarg0);
}
extern fn QAbstractTextDocumentLayout_pageCountChanged_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = arg0 as i32;
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractTextDocumentLayout_pageCountChanged_signal_connect for fn(i32) {
fn connect(self, sigthis: QAbstractTextDocumentLayout_pageCountChanged_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractTextDocumentLayout_pageCountChanged_signal_connect_cb_0 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout16pageCountChangedEi(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractTextDocumentLayout_pageCountChanged_signal_connect for Box<Fn(i32)> {
fn connect(self, sigthis: QAbstractTextDocumentLayout_pageCountChanged_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractTextDocumentLayout_pageCountChanged_signal_connect_cb_box_0 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout16pageCountChangedEi(arg0, arg1, arg2)};
}
}
// documentSizeChanged(const class QSizeF &)
extern fn QAbstractTextDocumentLayout_documentSizeChanged_signal_connect_cb_1(rsfptr:fn(QSizeF), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QSizeF::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QAbstractTextDocumentLayout_documentSizeChanged_signal_connect_cb_box_1(rsfptr_raw:*mut Box<Fn(QSizeF)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QSizeF::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractTextDocumentLayout_documentSizeChanged_signal_connect for fn(QSizeF) {
fn connect(self, sigthis: QAbstractTextDocumentLayout_documentSizeChanged_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractTextDocumentLayout_documentSizeChanged_signal_connect_cb_1 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout19documentSizeChangedERK6QSizeF(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractTextDocumentLayout_documentSizeChanged_signal_connect for Box<Fn(QSizeF)> {
fn connect(self, sigthis: QAbstractTextDocumentLayout_documentSizeChanged_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractTextDocumentLayout_documentSizeChanged_signal_connect_cb_box_1 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout19documentSizeChangedERK6QSizeF(arg0, arg1, arg2)};
}
}
// updateBlock(const class QTextBlock &)
extern fn QAbstractTextDocumentLayout_updateBlock_signal_connect_cb_2(rsfptr:fn(QTextBlock), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QTextBlock::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QAbstractTextDocumentLayout_updateBlock_signal_connect_cb_box_2(rsfptr_raw:*mut Box<Fn(QTextBlock)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QTextBlock::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QAbstractTextDocumentLayout_updateBlock_signal_connect for fn(QTextBlock) {
fn connect(self, sigthis: QAbstractTextDocumentLayout_updateBlock_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractTextDocumentLayout_updateBlock_signal_connect_cb_2 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout11updateBlockERK10QTextBlock(arg0, arg1, arg2)};
}
}
impl /* trait */ QAbstractTextDocumentLayout_updateBlock_signal_connect for Box<Fn(QTextBlock)> {
fn connect(self, sigthis: QAbstractTextDocumentLayout_updateBlock_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QAbstractTextDocumentLayout_updateBlock_signal_connect_cb_box_2 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QAbstractTextDocumentLayout_SlotProxy_connect__ZN27QAbstractTextDocumentLayout11updateBlockERK10QTextBlock(arg0, arg1, arg2)};
}
}
// <= body block end
|
use bitcoin::Transaction;
use CRgbNeededTx;
use CRgbSerializedTx;
use generics::WrapperOf;
use rgb::traits::NeededTx;
use std::collections::HashMap;
use std::mem;
#[no_mangle]
pub extern "C" fn rgb_init_needed_tx_map(map: &mut Box<HashMap<NeededTx, Transaction>>) {
let mut new_map = Box::new(HashMap::new());
mem::swap(&mut new_map, &mut *map);
mem::forget(new_map);
}
#[no_mangle]
pub extern "C" fn rgb_push_needed_tx_map(map: &mut HashMap<NeededTx, Transaction>, key: &CRgbNeededTx, val: &CRgbSerializedTx) {
map.insert(key.decode(), val.decode());
}
#[no_mangle]
pub extern "C" fn rgb_debug_print_needed_tx_map(map: &HashMap<NeededTx, Transaction>) {
println!("{:#?}", map);
} |
#![deny(unreachable_patterns)]
#![deny(unknown_lints)]
#![deny(unused_variables)]
#![deny(unused_imports)]
// Unused results is more often than not an error
#![deny(unused_must_use)]
//#![deny(unused_extern_crates)]
extern crate actix_web;
extern crate bigneon_db;
extern crate diesel;
extern crate dotenv;
//extern crate futures;
//extern crate http;
//extern crate hyper;
//extern crate hyper_tls;
extern crate itertools;
extern crate lettre;
extern crate lettre_email;
extern crate scheduled_thread_pool;
//extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
extern crate crypto;
extern crate jwt;
extern crate serde_with;
extern crate tari_client;
//extern crate url;
extern crate uuid;
#[macro_use]
extern crate log;
extern crate chrono;
extern crate log4rs;
extern crate reqwest;
extern crate rustc_serialize;
extern crate stripe;
#[macro_use]
extern crate validator_derive;
extern crate validator;
pub mod auth;
pub mod config;
pub mod controllers;
pub mod db;
pub mod errors;
pub mod helpers;
pub mod mail;
pub mod middleware;
pub mod models;
mod payments;
mod routing;
pub mod server;
pub mod utils;
|
fn main() {
if let Some(x) = Some(1) {
}
} |
use std::{fmt, str::FromStr};
use hex::FromHex;
use rand::Rng;
use serde::{Deserialize, Serialize};
// Zenith ID is a 128-bit random ID.
// Used to represent various identifiers. Provides handy utility methods and impls.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)]
struct ZId([u8; 16]);
impl ZId {
pub fn get_from_buf(buf: &mut dyn bytes::Buf) -> ZId {
let mut arr = [0u8; 16];
buf.copy_to_slice(&mut arr);
ZId::from(arr)
}
pub fn as_arr(&self) -> [u8; 16] {
self.0
}
pub fn generate() -> Self {
let mut tli_buf = [0u8; 16];
rand::thread_rng().fill(&mut tli_buf);
ZId::from(tli_buf)
}
}
impl FromStr for ZId {
type Err = hex::FromHexError;
fn from_str(s: &str) -> Result<ZId, Self::Err> {
Self::from_hex(s)
}
}
// this is needed for pretty serialization and deserialization of ZId's using serde integration with hex crate
impl FromHex for ZId {
type Error = hex::FromHexError;
fn from_hex<T: AsRef<[u8]>>(hex: T) -> Result<Self, Self::Error> {
let mut buf: [u8; 16] = [0u8; 16];
hex::decode_to_slice(hex, &mut buf)?;
Ok(ZId(buf))
}
}
impl AsRef<[u8]> for ZId {
fn as_ref(&self) -> &[u8] {
&self.0
}
}
impl From<[u8; 16]> for ZId {
fn from(b: [u8; 16]) -> Self {
ZId(b)
}
}
impl fmt::Display for ZId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&hex::encode(self.0))
}
}
macro_rules! zid_newtype {
($t:ident) => {
impl $t {
pub fn get_from_buf(buf: &mut dyn bytes::Buf) -> $t {
$t(ZId::get_from_buf(buf))
}
pub fn as_arr(&self) -> [u8; 16] {
self.0.as_arr()
}
pub fn generate() -> Self {
$t(ZId::generate())
}
}
impl FromStr for $t {
type Err = hex::FromHexError;
fn from_str(s: &str) -> Result<$t, Self::Err> {
let value = ZId::from_str(s)?;
Ok($t(value))
}
}
impl From<[u8; 16]> for $t {
fn from(b: [u8; 16]) -> Self {
$t(ZId::from(b))
}
}
impl FromHex for $t {
type Error = hex::FromHexError;
fn from_hex<T: AsRef<[u8]>>(hex: T) -> Result<Self, Self::Error> {
Ok($t(ZId::from_hex(hex)?))
}
}
impl AsRef<[u8]> for $t {
fn as_ref(&self) -> &[u8] {
&self.0 .0
}
}
impl fmt::Display for $t {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
};
}
/// Zenith timeline IDs are different from PostgreSQL timeline
/// IDs. They serve a similar purpose though: they differentiate
/// between different "histories" of the same cluster. However,
/// PostgreSQL timeline IDs are a bit cumbersome, because they are only
/// 32-bits wide, and they must be in ascending order in any given
/// timeline history. Those limitations mean that we cannot generate a
/// new PostgreSQL timeline ID by just generating a random number. And
/// that in turn is problematic for the "pull/push" workflow, where you
/// have a local copy of a zenith repository, and you periodically sync
/// the local changes with a remote server. When you work "detached"
/// from the remote server, you cannot create a PostgreSQL timeline ID
/// that's guaranteed to be different from all existing timelines in
/// the remote server. For example, if two people are having a clone of
/// the repository on their laptops, and they both create a new branch
/// with different name. What timeline ID would they assign to their
/// branches? If they pick the same one, and later try to push the
/// branches to the same remote server, they will get mixed up.
///
/// To avoid those issues, Zenith has its own concept of timelines that
/// is separate from PostgreSQL timelines, and doesn't have those
/// limitations. A zenith timeline is identified by a 128-bit ID, which
/// is usually printed out as a hex string.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd, Serialize, Deserialize)]
pub struct ZTimelineId(ZId);
zid_newtype!(ZTimelineId);
// Zenith Tenant Id represents identifiar of a particular tenant.
// Is used for distinguishing requests and data belonging to different users.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)]
pub struct ZTenantId(ZId);
zid_newtype!(ZTenantId);
|
extern crate regex;
extern crate glob;
mod network;
use std::process::Command;
use glob::glob;
use network::Network;
use std::io::prelude::*;
use std::fs::File;
fn main() {
let config = glob("/etc/wpa_supplicant/wpa_supplicant-*.conf");
for file in config.unwrap() {
let mut f = File::open(file.unwrap()).unwrap();
let mut s = String::new();
f.read_to_string(&mut s).unwrap();
print!("{}", s)
}
let command = Command::new("iwlist")
.arg("wlp2s0")
.arg("scan")
.output()
.unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
let out = String::from_utf8_lossy(&command.stdout)
.into_owned();
let split = out.split("Cell");
let mut output: Vec<&str> = split.collect();
let mut networks: Vec<Network> = Vec::new();
output.remove(0);
for cell in output {
let network = Network::from_scan(&cell);
if !networks.contains(&network) && network.name != "" {
networks.push(network);
}
}
for network in networks {
println!("{} {} {}", network.name, network.signal, network.encrypted);
}
}
|
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qspinbox.h
// dst-file: /src/widgets/qspinbox.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
// <= main block end
// use block begin =>
use super::qabstractspinbox::*; // 773
use std::ops::Deref;
use super::super::core::qstring::*; // 771
use super::qwidget::*; // 773
use super::super::core::qobjectdefs::*; // 771
// <= use block end
// ext block begin =>
// #[link(name = "Qt5Core")]
// #[link(name = "Qt5Gui")]
// #[link(name = "Qt5Widgets")]
// #[link(name = "QtInline")]
extern {
fn QSpinBox_Class_Size() -> c_int;
// proto: void QSpinBox::setMinimum(int min);
fn C_ZN8QSpinBox10setMinimumEi(qthis: u64 /* *mut c_void*/, arg0: c_int);
// proto: QString QSpinBox::cleanText();
fn C_ZNK8QSpinBox9cleanTextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: int QSpinBox::value();
fn C_ZNK8QSpinBox5valueEv(qthis: u64 /* *mut c_void*/) -> c_int;
// proto: void QSpinBox::~QSpinBox();
fn C_ZN8QSpinBoxD2Ev(qthis: u64 /* *mut c_void*/);
// proto: void QSpinBox::setMaximum(int max);
fn C_ZN8QSpinBox10setMaximumEi(qthis: u64 /* *mut c_void*/, arg0: c_int);
// proto: void QSpinBox::setValue(int val);
fn C_ZN8QSpinBox8setValueEi(qthis: u64 /* *mut c_void*/, arg0: c_int);
// proto: void QSpinBox::setDisplayIntegerBase(int base);
fn C_ZN8QSpinBox21setDisplayIntegerBaseEi(qthis: u64 /* *mut c_void*/, arg0: c_int);
// proto: void QSpinBox::QSpinBox(QWidget * parent);
fn C_ZN8QSpinBoxC2EP7QWidget(arg0: *mut c_void) -> u64;
// proto: int QSpinBox::singleStep();
fn C_ZNK8QSpinBox10singleStepEv(qthis: u64 /* *mut c_void*/) -> c_int;
// proto: int QSpinBox::displayIntegerBase();
fn C_ZNK8QSpinBox18displayIntegerBaseEv(qthis: u64 /* *mut c_void*/) -> c_int;
// proto: void QSpinBox::setSuffix(const QString & suffix);
fn C_ZN8QSpinBox9setSuffixERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: int QSpinBox::maximum();
fn C_ZNK8QSpinBox7maximumEv(qthis: u64 /* *mut c_void*/) -> c_int;
// proto: void QSpinBox::setPrefix(const QString & prefix);
fn C_ZN8QSpinBox9setPrefixERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: QString QSpinBox::prefix();
fn C_ZNK8QSpinBox6prefixEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: const QMetaObject * QSpinBox::metaObject();
fn C_ZNK8QSpinBox10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: QString QSpinBox::suffix();
fn C_ZNK8QSpinBox6suffixEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: int QSpinBox::minimum();
fn C_ZNK8QSpinBox7minimumEv(qthis: u64 /* *mut c_void*/) -> c_int;
// proto: void QSpinBox::setSingleStep(int val);
fn C_ZN8QSpinBox13setSingleStepEi(qthis: u64 /* *mut c_void*/, arg0: c_int);
// proto: void QSpinBox::setRange(int min, int max);
fn C_ZN8QSpinBox8setRangeEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int);
fn QDoubleSpinBox_Class_Size() -> c_int;
// proto: QString QDoubleSpinBox::textFromValue(double val);
fn C_ZNK14QDoubleSpinBox13textFromValueEd(qthis: u64 /* *mut c_void*/, arg0: c_double) -> *mut c_void;
// proto: void QDoubleSpinBox::setSingleStep(double val);
fn C_ZN14QDoubleSpinBox13setSingleStepEd(qthis: u64 /* *mut c_void*/, arg0: c_double);
// proto: double QDoubleSpinBox::minimum();
fn C_ZNK14QDoubleSpinBox7minimumEv(qthis: u64 /* *mut c_void*/) -> c_double;
// proto: double QDoubleSpinBox::valueFromText(const QString & text);
fn C_ZNK14QDoubleSpinBox13valueFromTextERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_double;
// proto: const QMetaObject * QDoubleSpinBox::metaObject();
fn C_ZNK14QDoubleSpinBox10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QDoubleSpinBox::setValue(double val);
fn C_ZN14QDoubleSpinBox8setValueEd(qthis: u64 /* *mut c_void*/, arg0: c_double);
// proto: void QDoubleSpinBox::setSuffix(const QString & suffix);
fn C_ZN14QDoubleSpinBox9setSuffixERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: int QDoubleSpinBox::decimals();
fn C_ZNK14QDoubleSpinBox8decimalsEv(qthis: u64 /* *mut c_void*/) -> c_int;
// proto: QString QDoubleSpinBox::prefix();
fn C_ZNK14QDoubleSpinBox6prefixEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: double QDoubleSpinBox::singleStep();
fn C_ZNK14QDoubleSpinBox10singleStepEv(qthis: u64 /* *mut c_void*/) -> c_double;
// proto: void QDoubleSpinBox::~QDoubleSpinBox();
fn C_ZN14QDoubleSpinBoxD2Ev(qthis: u64 /* *mut c_void*/);
// proto: void QDoubleSpinBox::fixup(QString & str);
fn C_ZNK14QDoubleSpinBox5fixupER7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: void QDoubleSpinBox::setPrefix(const QString & prefix);
fn C_ZN14QDoubleSpinBox9setPrefixERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void);
// proto: QString QDoubleSpinBox::cleanText();
fn C_ZNK14QDoubleSpinBox9cleanTextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
// proto: void QDoubleSpinBox::setMinimum(double min);
fn C_ZN14QDoubleSpinBox10setMinimumEd(qthis: u64 /* *mut c_void*/, arg0: c_double);
// proto: void QDoubleSpinBox::setMaximum(double max);
fn C_ZN14QDoubleSpinBox10setMaximumEd(qthis: u64 /* *mut c_void*/, arg0: c_double);
// proto: void QDoubleSpinBox::setDecimals(int prec);
fn C_ZN14QDoubleSpinBox11setDecimalsEi(qthis: u64 /* *mut c_void*/, arg0: c_int);
// proto: double QDoubleSpinBox::value();
fn C_ZNK14QDoubleSpinBox5valueEv(qthis: u64 /* *mut c_void*/) -> c_double;
// proto: void QDoubleSpinBox::setRange(double min, double max);
fn C_ZN14QDoubleSpinBox8setRangeEdd(qthis: u64 /* *mut c_void*/, arg0: c_double, arg1: c_double);
// proto: void QDoubleSpinBox::QDoubleSpinBox(QWidget * parent);
fn C_ZN14QDoubleSpinBoxC2EP7QWidget(arg0: *mut c_void) -> u64;
// proto: double QDoubleSpinBox::maximum();
fn C_ZNK14QDoubleSpinBox7maximumEv(qthis: u64 /* *mut c_void*/) -> c_double;
// proto: QString QDoubleSpinBox::suffix();
fn C_ZNK14QDoubleSpinBox6suffixEv(qthis: u64 /* *mut c_void*/) -> *mut c_void;
fn QSpinBox_SlotProxy_connect__ZN8QSpinBox12valueChangedERK7QString(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QSpinBox_SlotProxy_connect__ZN8QSpinBox12valueChangedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QDoubleSpinBox_SlotProxy_connect__ZN14QDoubleSpinBox12valueChangedEd(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
fn QDoubleSpinBox_SlotProxy_connect__ZN14QDoubleSpinBox12valueChangedERK7QString(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void);
} // <= ext block end
// body block begin =>
// class sizeof(QSpinBox)=1
#[derive(Default)]
pub struct QSpinBox {
qbase: QAbstractSpinBox,
pub qclsinst: u64 /* *mut c_void*/,
pub _valueChanged: QSpinBox_valueChanged_signal,
}
// class sizeof(QDoubleSpinBox)=1
#[derive(Default)]
pub struct QDoubleSpinBox {
qbase: QAbstractSpinBox,
pub qclsinst: u64 /* *mut c_void*/,
pub _valueChanged: QDoubleSpinBox_valueChanged_signal,
}
impl /*struct*/ QSpinBox {
pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QSpinBox {
return QSpinBox{qbase: QAbstractSpinBox::inheritFrom(qthis), qclsinst: qthis, ..Default::default()};
}
}
impl Deref for QSpinBox {
type Target = QAbstractSpinBox;
fn deref(&self) -> &QAbstractSpinBox {
return & self.qbase;
}
}
impl AsRef<QAbstractSpinBox> for QSpinBox {
fn as_ref(& self) -> & QAbstractSpinBox {
return & self.qbase;
}
}
// proto: void QSpinBox::setMinimum(int min);
impl /*struct*/ QSpinBox {
pub fn setMinimum<RetType, T: QSpinBox_setMinimum<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setMinimum(self);
// return 1;
}
}
pub trait QSpinBox_setMinimum<RetType> {
fn setMinimum(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::setMinimum(int min);
impl<'a> /*trait*/ QSpinBox_setMinimum<()> for (i32) {
fn setMinimum(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBox10setMinimumEi()};
let arg0 = self as c_int;
unsafe {C_ZN8QSpinBox10setMinimumEi(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QString QSpinBox::cleanText();
impl /*struct*/ QSpinBox {
pub fn cleanText<RetType, T: QSpinBox_cleanText<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.cleanText(self);
// return 1;
}
}
pub trait QSpinBox_cleanText<RetType> {
fn cleanText(self , rsthis: & QSpinBox) -> RetType;
}
// proto: QString QSpinBox::cleanText();
impl<'a> /*trait*/ QSpinBox_cleanText<QString> for () {
fn cleanText(self , rsthis: & QSpinBox) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox9cleanTextEv()};
let mut ret = unsafe {C_ZNK8QSpinBox9cleanTextEv(rsthis.qclsinst)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: int QSpinBox::value();
impl /*struct*/ QSpinBox {
pub fn value<RetType, T: QSpinBox_value<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.value(self);
// return 1;
}
}
pub trait QSpinBox_value<RetType> {
fn value(self , rsthis: & QSpinBox) -> RetType;
}
// proto: int QSpinBox::value();
impl<'a> /*trait*/ QSpinBox_value<i32> for () {
fn value(self , rsthis: & QSpinBox) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox5valueEv()};
let mut ret = unsafe {C_ZNK8QSpinBox5valueEv(rsthis.qclsinst)};
return ret as i32; // 1
// return 1;
}
}
// proto: void QSpinBox::~QSpinBox();
impl /*struct*/ QSpinBox {
pub fn free<RetType, T: QSpinBox_free<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.free(self);
// return 1;
}
}
pub trait QSpinBox_free<RetType> {
fn free(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::~QSpinBox();
impl<'a> /*trait*/ QSpinBox_free<()> for () {
fn free(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBoxD2Ev()};
unsafe {C_ZN8QSpinBoxD2Ev(rsthis.qclsinst)};
// return 1;
}
}
// proto: void QSpinBox::setMaximum(int max);
impl /*struct*/ QSpinBox {
pub fn setMaximum<RetType, T: QSpinBox_setMaximum<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setMaximum(self);
// return 1;
}
}
pub trait QSpinBox_setMaximum<RetType> {
fn setMaximum(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::setMaximum(int max);
impl<'a> /*trait*/ QSpinBox_setMaximum<()> for (i32) {
fn setMaximum(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBox10setMaximumEi()};
let arg0 = self as c_int;
unsafe {C_ZN8QSpinBox10setMaximumEi(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QSpinBox::setValue(int val);
impl /*struct*/ QSpinBox {
pub fn setValue<RetType, T: QSpinBox_setValue<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setValue(self);
// return 1;
}
}
pub trait QSpinBox_setValue<RetType> {
fn setValue(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::setValue(int val);
impl<'a> /*trait*/ QSpinBox_setValue<()> for (i32) {
fn setValue(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBox8setValueEi()};
let arg0 = self as c_int;
unsafe {C_ZN8QSpinBox8setValueEi(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QSpinBox::setDisplayIntegerBase(int base);
impl /*struct*/ QSpinBox {
pub fn setDisplayIntegerBase<RetType, T: QSpinBox_setDisplayIntegerBase<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setDisplayIntegerBase(self);
// return 1;
}
}
pub trait QSpinBox_setDisplayIntegerBase<RetType> {
fn setDisplayIntegerBase(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::setDisplayIntegerBase(int base);
impl<'a> /*trait*/ QSpinBox_setDisplayIntegerBase<()> for (i32) {
fn setDisplayIntegerBase(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBox21setDisplayIntegerBaseEi()};
let arg0 = self as c_int;
unsafe {C_ZN8QSpinBox21setDisplayIntegerBaseEi(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QSpinBox::QSpinBox(QWidget * parent);
impl /*struct*/ QSpinBox {
pub fn new<T: QSpinBox_new>(value: T) -> QSpinBox {
let rsthis = value.new();
return rsthis;
// return 1;
}
}
pub trait QSpinBox_new {
fn new(self) -> QSpinBox;
}
// proto: void QSpinBox::QSpinBox(QWidget * parent);
impl<'a> /*trait*/ QSpinBox_new for (Option<&'a QWidget>) {
fn new(self) -> QSpinBox {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBoxC2EP7QWidget()};
let ctysz: c_int = unsafe{QSpinBox_Class_Size()};
let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64;
let arg0 = (if self.is_none() {0} else {self.unwrap().qclsinst}) as *mut c_void;
let qthis: u64 = unsafe {C_ZN8QSpinBoxC2EP7QWidget(arg0)};
let rsthis = QSpinBox{qbase: QAbstractSpinBox::inheritFrom(qthis), qclsinst: qthis, ..Default::default()};
return rsthis;
// return 1;
}
}
// proto: int QSpinBox::singleStep();
impl /*struct*/ QSpinBox {
pub fn singleStep<RetType, T: QSpinBox_singleStep<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.singleStep(self);
// return 1;
}
}
pub trait QSpinBox_singleStep<RetType> {
fn singleStep(self , rsthis: & QSpinBox) -> RetType;
}
// proto: int QSpinBox::singleStep();
impl<'a> /*trait*/ QSpinBox_singleStep<i32> for () {
fn singleStep(self , rsthis: & QSpinBox) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox10singleStepEv()};
let mut ret = unsafe {C_ZNK8QSpinBox10singleStepEv(rsthis.qclsinst)};
return ret as i32; // 1
// return 1;
}
}
// proto: int QSpinBox::displayIntegerBase();
impl /*struct*/ QSpinBox {
pub fn displayIntegerBase<RetType, T: QSpinBox_displayIntegerBase<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.displayIntegerBase(self);
// return 1;
}
}
pub trait QSpinBox_displayIntegerBase<RetType> {
fn displayIntegerBase(self , rsthis: & QSpinBox) -> RetType;
}
// proto: int QSpinBox::displayIntegerBase();
impl<'a> /*trait*/ QSpinBox_displayIntegerBase<i32> for () {
fn displayIntegerBase(self , rsthis: & QSpinBox) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox18displayIntegerBaseEv()};
let mut ret = unsafe {C_ZNK8QSpinBox18displayIntegerBaseEv(rsthis.qclsinst)};
return ret as i32; // 1
// return 1;
}
}
// proto: void QSpinBox::setSuffix(const QString & suffix);
impl /*struct*/ QSpinBox {
pub fn setSuffix<RetType, T: QSpinBox_setSuffix<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setSuffix(self);
// return 1;
}
}
pub trait QSpinBox_setSuffix<RetType> {
fn setSuffix(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::setSuffix(const QString & suffix);
impl<'a> /*trait*/ QSpinBox_setSuffix<()> for (&'a QString) {
fn setSuffix(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBox9setSuffixERK7QString()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN8QSpinBox9setSuffixERK7QString(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: int QSpinBox::maximum();
impl /*struct*/ QSpinBox {
pub fn maximum<RetType, T: QSpinBox_maximum<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.maximum(self);
// return 1;
}
}
pub trait QSpinBox_maximum<RetType> {
fn maximum(self , rsthis: & QSpinBox) -> RetType;
}
// proto: int QSpinBox::maximum();
impl<'a> /*trait*/ QSpinBox_maximum<i32> for () {
fn maximum(self , rsthis: & QSpinBox) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox7maximumEv()};
let mut ret = unsafe {C_ZNK8QSpinBox7maximumEv(rsthis.qclsinst)};
return ret as i32; // 1
// return 1;
}
}
// proto: void QSpinBox::setPrefix(const QString & prefix);
impl /*struct*/ QSpinBox {
pub fn setPrefix<RetType, T: QSpinBox_setPrefix<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setPrefix(self);
// return 1;
}
}
pub trait QSpinBox_setPrefix<RetType> {
fn setPrefix(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::setPrefix(const QString & prefix);
impl<'a> /*trait*/ QSpinBox_setPrefix<()> for (&'a QString) {
fn setPrefix(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBox9setPrefixERK7QString()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN8QSpinBox9setPrefixERK7QString(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QString QSpinBox::prefix();
impl /*struct*/ QSpinBox {
pub fn prefix<RetType, T: QSpinBox_prefix<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.prefix(self);
// return 1;
}
}
pub trait QSpinBox_prefix<RetType> {
fn prefix(self , rsthis: & QSpinBox) -> RetType;
}
// proto: QString QSpinBox::prefix();
impl<'a> /*trait*/ QSpinBox_prefix<QString> for () {
fn prefix(self , rsthis: & QSpinBox) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox6prefixEv()};
let mut ret = unsafe {C_ZNK8QSpinBox6prefixEv(rsthis.qclsinst)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: const QMetaObject * QSpinBox::metaObject();
impl /*struct*/ QSpinBox {
pub fn metaObject<RetType, T: QSpinBox_metaObject<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.metaObject(self);
// return 1;
}
}
pub trait QSpinBox_metaObject<RetType> {
fn metaObject(self , rsthis: & QSpinBox) -> RetType;
}
// proto: const QMetaObject * QSpinBox::metaObject();
impl<'a> /*trait*/ QSpinBox_metaObject<QMetaObject> for () {
fn metaObject(self , rsthis: & QSpinBox) -> QMetaObject {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox10metaObjectEv()};
let mut ret = unsafe {C_ZNK8QSpinBox10metaObjectEv(rsthis.qclsinst)};
let mut ret1 = QMetaObject::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: QString QSpinBox::suffix();
impl /*struct*/ QSpinBox {
pub fn suffix<RetType, T: QSpinBox_suffix<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.suffix(self);
// return 1;
}
}
pub trait QSpinBox_suffix<RetType> {
fn suffix(self , rsthis: & QSpinBox) -> RetType;
}
// proto: QString QSpinBox::suffix();
impl<'a> /*trait*/ QSpinBox_suffix<QString> for () {
fn suffix(self , rsthis: & QSpinBox) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox6suffixEv()};
let mut ret = unsafe {C_ZNK8QSpinBox6suffixEv(rsthis.qclsinst)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: int QSpinBox::minimum();
impl /*struct*/ QSpinBox {
pub fn minimum<RetType, T: QSpinBox_minimum<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.minimum(self);
// return 1;
}
}
pub trait QSpinBox_minimum<RetType> {
fn minimum(self , rsthis: & QSpinBox) -> RetType;
}
// proto: int QSpinBox::minimum();
impl<'a> /*trait*/ QSpinBox_minimum<i32> for () {
fn minimum(self , rsthis: & QSpinBox) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK8QSpinBox7minimumEv()};
let mut ret = unsafe {C_ZNK8QSpinBox7minimumEv(rsthis.qclsinst)};
return ret as i32; // 1
// return 1;
}
}
// proto: void QSpinBox::setSingleStep(int val);
impl /*struct*/ QSpinBox {
pub fn setSingleStep<RetType, T: QSpinBox_setSingleStep<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setSingleStep(self);
// return 1;
}
}
pub trait QSpinBox_setSingleStep<RetType> {
fn setSingleStep(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::setSingleStep(int val);
impl<'a> /*trait*/ QSpinBox_setSingleStep<()> for (i32) {
fn setSingleStep(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBox13setSingleStepEi()};
let arg0 = self as c_int;
unsafe {C_ZN8QSpinBox13setSingleStepEi(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QSpinBox::setRange(int min, int max);
impl /*struct*/ QSpinBox {
pub fn setRange<RetType, T: QSpinBox_setRange<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setRange(self);
// return 1;
}
}
pub trait QSpinBox_setRange<RetType> {
fn setRange(self , rsthis: & QSpinBox) -> RetType;
}
// proto: void QSpinBox::setRange(int min, int max);
impl<'a> /*trait*/ QSpinBox_setRange<()> for (i32, i32) {
fn setRange(self , rsthis: & QSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN8QSpinBox8setRangeEii()};
let arg0 = self.0 as c_int;
let arg1 = self.1 as c_int;
unsafe {C_ZN8QSpinBox8setRangeEii(rsthis.qclsinst, arg0, arg1)};
// return 1;
}
}
impl /*struct*/ QDoubleSpinBox {
pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QDoubleSpinBox {
return QDoubleSpinBox{qbase: QAbstractSpinBox::inheritFrom(qthis), qclsinst: qthis, ..Default::default()};
}
}
impl Deref for QDoubleSpinBox {
type Target = QAbstractSpinBox;
fn deref(&self) -> &QAbstractSpinBox {
return & self.qbase;
}
}
impl AsRef<QAbstractSpinBox> for QDoubleSpinBox {
fn as_ref(& self) -> & QAbstractSpinBox {
return & self.qbase;
}
}
// proto: QString QDoubleSpinBox::textFromValue(double val);
impl /*struct*/ QDoubleSpinBox {
pub fn textFromValue<RetType, T: QDoubleSpinBox_textFromValue<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.textFromValue(self);
// return 1;
}
}
pub trait QDoubleSpinBox_textFromValue<RetType> {
fn textFromValue(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: QString QDoubleSpinBox::textFromValue(double val);
impl<'a> /*trait*/ QDoubleSpinBox_textFromValue<QString> for (f64) {
fn textFromValue(self , rsthis: & QDoubleSpinBox) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox13textFromValueEd()};
let arg0 = self as c_double;
let mut ret = unsafe {C_ZNK14QDoubleSpinBox13textFromValueEd(rsthis.qclsinst, arg0)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QDoubleSpinBox::setSingleStep(double val);
impl /*struct*/ QDoubleSpinBox {
pub fn setSingleStep<RetType, T: QDoubleSpinBox_setSingleStep<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setSingleStep(self);
// return 1;
}
}
pub trait QDoubleSpinBox_setSingleStep<RetType> {
fn setSingleStep(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::setSingleStep(double val);
impl<'a> /*trait*/ QDoubleSpinBox_setSingleStep<()> for (f64) {
fn setSingleStep(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBox13setSingleStepEd()};
let arg0 = self as c_double;
unsafe {C_ZN14QDoubleSpinBox13setSingleStepEd(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: double QDoubleSpinBox::minimum();
impl /*struct*/ QDoubleSpinBox {
pub fn minimum<RetType, T: QDoubleSpinBox_minimum<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.minimum(self);
// return 1;
}
}
pub trait QDoubleSpinBox_minimum<RetType> {
fn minimum(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: double QDoubleSpinBox::minimum();
impl<'a> /*trait*/ QDoubleSpinBox_minimum<f64> for () {
fn minimum(self , rsthis: & QDoubleSpinBox) -> f64 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox7minimumEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox7minimumEv(rsthis.qclsinst)};
return ret as f64; // 1
// return 1;
}
}
// proto: double QDoubleSpinBox::valueFromText(const QString & text);
impl /*struct*/ QDoubleSpinBox {
pub fn valueFromText<RetType, T: QDoubleSpinBox_valueFromText<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.valueFromText(self);
// return 1;
}
}
pub trait QDoubleSpinBox_valueFromText<RetType> {
fn valueFromText(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: double QDoubleSpinBox::valueFromText(const QString & text);
impl<'a> /*trait*/ QDoubleSpinBox_valueFromText<f64> for (&'a QString) {
fn valueFromText(self , rsthis: & QDoubleSpinBox) -> f64 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox13valueFromTextERK7QString()};
let arg0 = self.qclsinst as *mut c_void;
let mut ret = unsafe {C_ZNK14QDoubleSpinBox13valueFromTextERK7QString(rsthis.qclsinst, arg0)};
return ret as f64; // 1
// return 1;
}
}
// proto: const QMetaObject * QDoubleSpinBox::metaObject();
impl /*struct*/ QDoubleSpinBox {
pub fn metaObject<RetType, T: QDoubleSpinBox_metaObject<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.metaObject(self);
// return 1;
}
}
pub trait QDoubleSpinBox_metaObject<RetType> {
fn metaObject(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: const QMetaObject * QDoubleSpinBox::metaObject();
impl<'a> /*trait*/ QDoubleSpinBox_metaObject<QMetaObject> for () {
fn metaObject(self , rsthis: & QDoubleSpinBox) -> QMetaObject {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox10metaObjectEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox10metaObjectEv(rsthis.qclsinst)};
let mut ret1 = QMetaObject::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QDoubleSpinBox::setValue(double val);
impl /*struct*/ QDoubleSpinBox {
pub fn setValue<RetType, T: QDoubleSpinBox_setValue<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setValue(self);
// return 1;
}
}
pub trait QDoubleSpinBox_setValue<RetType> {
fn setValue(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::setValue(double val);
impl<'a> /*trait*/ QDoubleSpinBox_setValue<()> for (f64) {
fn setValue(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBox8setValueEd()};
let arg0 = self as c_double;
unsafe {C_ZN14QDoubleSpinBox8setValueEd(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QDoubleSpinBox::setSuffix(const QString & suffix);
impl /*struct*/ QDoubleSpinBox {
pub fn setSuffix<RetType, T: QDoubleSpinBox_setSuffix<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setSuffix(self);
// return 1;
}
}
pub trait QDoubleSpinBox_setSuffix<RetType> {
fn setSuffix(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::setSuffix(const QString & suffix);
impl<'a> /*trait*/ QDoubleSpinBox_setSuffix<()> for (&'a QString) {
fn setSuffix(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBox9setSuffixERK7QString()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN14QDoubleSpinBox9setSuffixERK7QString(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: int QDoubleSpinBox::decimals();
impl /*struct*/ QDoubleSpinBox {
pub fn decimals<RetType, T: QDoubleSpinBox_decimals<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.decimals(self);
// return 1;
}
}
pub trait QDoubleSpinBox_decimals<RetType> {
fn decimals(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: int QDoubleSpinBox::decimals();
impl<'a> /*trait*/ QDoubleSpinBox_decimals<i32> for () {
fn decimals(self , rsthis: & QDoubleSpinBox) -> i32 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox8decimalsEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox8decimalsEv(rsthis.qclsinst)};
return ret as i32; // 1
// return 1;
}
}
// proto: QString QDoubleSpinBox::prefix();
impl /*struct*/ QDoubleSpinBox {
pub fn prefix<RetType, T: QDoubleSpinBox_prefix<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.prefix(self);
// return 1;
}
}
pub trait QDoubleSpinBox_prefix<RetType> {
fn prefix(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: QString QDoubleSpinBox::prefix();
impl<'a> /*trait*/ QDoubleSpinBox_prefix<QString> for () {
fn prefix(self , rsthis: & QDoubleSpinBox) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox6prefixEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox6prefixEv(rsthis.qclsinst)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: double QDoubleSpinBox::singleStep();
impl /*struct*/ QDoubleSpinBox {
pub fn singleStep<RetType, T: QDoubleSpinBox_singleStep<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.singleStep(self);
// return 1;
}
}
pub trait QDoubleSpinBox_singleStep<RetType> {
fn singleStep(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: double QDoubleSpinBox::singleStep();
impl<'a> /*trait*/ QDoubleSpinBox_singleStep<f64> for () {
fn singleStep(self , rsthis: & QDoubleSpinBox) -> f64 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox10singleStepEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox10singleStepEv(rsthis.qclsinst)};
return ret as f64; // 1
// return 1;
}
}
// proto: void QDoubleSpinBox::~QDoubleSpinBox();
impl /*struct*/ QDoubleSpinBox {
pub fn free<RetType, T: QDoubleSpinBox_free<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.free(self);
// return 1;
}
}
pub trait QDoubleSpinBox_free<RetType> {
fn free(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::~QDoubleSpinBox();
impl<'a> /*trait*/ QDoubleSpinBox_free<()> for () {
fn free(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBoxD2Ev()};
unsafe {C_ZN14QDoubleSpinBoxD2Ev(rsthis.qclsinst)};
// return 1;
}
}
// proto: void QDoubleSpinBox::fixup(QString & str);
impl /*struct*/ QDoubleSpinBox {
pub fn fixup<RetType, T: QDoubleSpinBox_fixup<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.fixup(self);
// return 1;
}
}
pub trait QDoubleSpinBox_fixup<RetType> {
fn fixup(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::fixup(QString & str);
impl<'a> /*trait*/ QDoubleSpinBox_fixup<()> for (&'a QString) {
fn fixup(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox5fixupER7QString()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZNK14QDoubleSpinBox5fixupER7QString(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QDoubleSpinBox::setPrefix(const QString & prefix);
impl /*struct*/ QDoubleSpinBox {
pub fn setPrefix<RetType, T: QDoubleSpinBox_setPrefix<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setPrefix(self);
// return 1;
}
}
pub trait QDoubleSpinBox_setPrefix<RetType> {
fn setPrefix(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::setPrefix(const QString & prefix);
impl<'a> /*trait*/ QDoubleSpinBox_setPrefix<()> for (&'a QString) {
fn setPrefix(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBox9setPrefixERK7QString()};
let arg0 = self.qclsinst as *mut c_void;
unsafe {C_ZN14QDoubleSpinBox9setPrefixERK7QString(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: QString QDoubleSpinBox::cleanText();
impl /*struct*/ QDoubleSpinBox {
pub fn cleanText<RetType, T: QDoubleSpinBox_cleanText<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.cleanText(self);
// return 1;
}
}
pub trait QDoubleSpinBox_cleanText<RetType> {
fn cleanText(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: QString QDoubleSpinBox::cleanText();
impl<'a> /*trait*/ QDoubleSpinBox_cleanText<QString> for () {
fn cleanText(self , rsthis: & QDoubleSpinBox) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox9cleanTextEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox9cleanTextEv(rsthis.qclsinst)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
// proto: void QDoubleSpinBox::setMinimum(double min);
impl /*struct*/ QDoubleSpinBox {
pub fn setMinimum<RetType, T: QDoubleSpinBox_setMinimum<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setMinimum(self);
// return 1;
}
}
pub trait QDoubleSpinBox_setMinimum<RetType> {
fn setMinimum(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::setMinimum(double min);
impl<'a> /*trait*/ QDoubleSpinBox_setMinimum<()> for (f64) {
fn setMinimum(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBox10setMinimumEd()};
let arg0 = self as c_double;
unsafe {C_ZN14QDoubleSpinBox10setMinimumEd(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QDoubleSpinBox::setMaximum(double max);
impl /*struct*/ QDoubleSpinBox {
pub fn setMaximum<RetType, T: QDoubleSpinBox_setMaximum<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setMaximum(self);
// return 1;
}
}
pub trait QDoubleSpinBox_setMaximum<RetType> {
fn setMaximum(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::setMaximum(double max);
impl<'a> /*trait*/ QDoubleSpinBox_setMaximum<()> for (f64) {
fn setMaximum(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBox10setMaximumEd()};
let arg0 = self as c_double;
unsafe {C_ZN14QDoubleSpinBox10setMaximumEd(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: void QDoubleSpinBox::setDecimals(int prec);
impl /*struct*/ QDoubleSpinBox {
pub fn setDecimals<RetType, T: QDoubleSpinBox_setDecimals<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setDecimals(self);
// return 1;
}
}
pub trait QDoubleSpinBox_setDecimals<RetType> {
fn setDecimals(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::setDecimals(int prec);
impl<'a> /*trait*/ QDoubleSpinBox_setDecimals<()> for (i32) {
fn setDecimals(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBox11setDecimalsEi()};
let arg0 = self as c_int;
unsafe {C_ZN14QDoubleSpinBox11setDecimalsEi(rsthis.qclsinst, arg0)};
// return 1;
}
}
// proto: double QDoubleSpinBox::value();
impl /*struct*/ QDoubleSpinBox {
pub fn value<RetType, T: QDoubleSpinBox_value<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.value(self);
// return 1;
}
}
pub trait QDoubleSpinBox_value<RetType> {
fn value(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: double QDoubleSpinBox::value();
impl<'a> /*trait*/ QDoubleSpinBox_value<f64> for () {
fn value(self , rsthis: & QDoubleSpinBox) -> f64 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox5valueEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox5valueEv(rsthis.qclsinst)};
return ret as f64; // 1
// return 1;
}
}
// proto: void QDoubleSpinBox::setRange(double min, double max);
impl /*struct*/ QDoubleSpinBox {
pub fn setRange<RetType, T: QDoubleSpinBox_setRange<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.setRange(self);
// return 1;
}
}
pub trait QDoubleSpinBox_setRange<RetType> {
fn setRange(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: void QDoubleSpinBox::setRange(double min, double max);
impl<'a> /*trait*/ QDoubleSpinBox_setRange<()> for (f64, f64) {
fn setRange(self , rsthis: & QDoubleSpinBox) -> () {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBox8setRangeEdd()};
let arg0 = self.0 as c_double;
let arg1 = self.1 as c_double;
unsafe {C_ZN14QDoubleSpinBox8setRangeEdd(rsthis.qclsinst, arg0, arg1)};
// return 1;
}
}
// proto: void QDoubleSpinBox::QDoubleSpinBox(QWidget * parent);
impl /*struct*/ QDoubleSpinBox {
pub fn new<T: QDoubleSpinBox_new>(value: T) -> QDoubleSpinBox {
let rsthis = value.new();
return rsthis;
// return 1;
}
}
pub trait QDoubleSpinBox_new {
fn new(self) -> QDoubleSpinBox;
}
// proto: void QDoubleSpinBox::QDoubleSpinBox(QWidget * parent);
impl<'a> /*trait*/ QDoubleSpinBox_new for (Option<&'a QWidget>) {
fn new(self) -> QDoubleSpinBox {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZN14QDoubleSpinBoxC2EP7QWidget()};
let ctysz: c_int = unsafe{QDoubleSpinBox_Class_Size()};
let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64;
let arg0 = (if self.is_none() {0} else {self.unwrap().qclsinst}) as *mut c_void;
let qthis: u64 = unsafe {C_ZN14QDoubleSpinBoxC2EP7QWidget(arg0)};
let rsthis = QDoubleSpinBox{qbase: QAbstractSpinBox::inheritFrom(qthis), qclsinst: qthis, ..Default::default()};
return rsthis;
// return 1;
}
}
// proto: double QDoubleSpinBox::maximum();
impl /*struct*/ QDoubleSpinBox {
pub fn maximum<RetType, T: QDoubleSpinBox_maximum<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.maximum(self);
// return 1;
}
}
pub trait QDoubleSpinBox_maximum<RetType> {
fn maximum(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: double QDoubleSpinBox::maximum();
impl<'a> /*trait*/ QDoubleSpinBox_maximum<f64> for () {
fn maximum(self , rsthis: & QDoubleSpinBox) -> f64 {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox7maximumEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox7maximumEv(rsthis.qclsinst)};
return ret as f64; // 1
// return 1;
}
}
// proto: QString QDoubleSpinBox::suffix();
impl /*struct*/ QDoubleSpinBox {
pub fn suffix<RetType, T: QDoubleSpinBox_suffix<RetType>>(& self, overload_args: T) -> RetType {
return overload_args.suffix(self);
// return 1;
}
}
pub trait QDoubleSpinBox_suffix<RetType> {
fn suffix(self , rsthis: & QDoubleSpinBox) -> RetType;
}
// proto: QString QDoubleSpinBox::suffix();
impl<'a> /*trait*/ QDoubleSpinBox_suffix<QString> for () {
fn suffix(self , rsthis: & QDoubleSpinBox) -> QString {
// let qthis: *mut c_void = unsafe{calloc(1, 32)};
// unsafe{_ZNK14QDoubleSpinBox6suffixEv()};
let mut ret = unsafe {C_ZNK14QDoubleSpinBox6suffixEv(rsthis.qclsinst)};
let mut ret1 = QString::inheritFrom(ret as u64);
return ret1;
// return 1;
}
}
#[derive(Default)] // for QSpinBox_valueChanged
pub struct QSpinBox_valueChanged_signal{poi:u64}
impl /* struct */ QSpinBox {
pub fn valueChanged(&self) -> QSpinBox_valueChanged_signal {
return QSpinBox_valueChanged_signal{poi:self.qclsinst};
}
}
impl /* struct */ QSpinBox_valueChanged_signal {
pub fn connect<T: QSpinBox_valueChanged_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QSpinBox_valueChanged_signal_connect {
fn connect(self, sigthis: QSpinBox_valueChanged_signal);
}
// valueChanged(const class QString &)
extern fn QSpinBox_valueChanged_signal_connect_cb_0(rsfptr:fn(QString), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QString::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QSpinBox_valueChanged_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(QString)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QString::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QSpinBox_valueChanged_signal_connect for fn(QString) {
fn connect(self, sigthis: QSpinBox_valueChanged_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QSpinBox_valueChanged_signal_connect_cb_0 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QSpinBox_SlotProxy_connect__ZN8QSpinBox12valueChangedERK7QString(arg0, arg1, arg2)};
}
}
impl /* trait */ QSpinBox_valueChanged_signal_connect for Box<Fn(QString)> {
fn connect(self, sigthis: QSpinBox_valueChanged_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QSpinBox_valueChanged_signal_connect_cb_box_0 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QSpinBox_SlotProxy_connect__ZN8QSpinBox12valueChangedERK7QString(arg0, arg1, arg2)};
}
}
// valueChanged(int)
extern fn QSpinBox_valueChanged_signal_connect_cb_1(rsfptr:fn(i32), arg0: c_int) {
println!("{}:{}", file!(), line!());
let rsarg0 = arg0 as i32;
rsfptr(rsarg0);
}
extern fn QSpinBox_valueChanged_signal_connect_cb_box_1(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = arg0 as i32;
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QSpinBox_valueChanged_signal_connect for fn(i32) {
fn connect(self, sigthis: QSpinBox_valueChanged_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QSpinBox_valueChanged_signal_connect_cb_1 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QSpinBox_SlotProxy_connect__ZN8QSpinBox12valueChangedEi(arg0, arg1, arg2)};
}
}
impl /* trait */ QSpinBox_valueChanged_signal_connect for Box<Fn(i32)> {
fn connect(self, sigthis: QSpinBox_valueChanged_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QSpinBox_valueChanged_signal_connect_cb_box_1 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QSpinBox_SlotProxy_connect__ZN8QSpinBox12valueChangedEi(arg0, arg1, arg2)};
}
}
#[derive(Default)] // for QDoubleSpinBox_valueChanged
pub struct QDoubleSpinBox_valueChanged_signal{poi:u64}
impl /* struct */ QDoubleSpinBox {
pub fn valueChanged(&self) -> QDoubleSpinBox_valueChanged_signal {
return QDoubleSpinBox_valueChanged_signal{poi:self.qclsinst};
}
}
impl /* struct */ QDoubleSpinBox_valueChanged_signal {
pub fn connect<T: QDoubleSpinBox_valueChanged_signal_connect>(self, overload_args: T) {
overload_args.connect(self);
}
}
pub trait QDoubleSpinBox_valueChanged_signal_connect {
fn connect(self, sigthis: QDoubleSpinBox_valueChanged_signal);
}
// valueChanged(double)
extern fn QDoubleSpinBox_valueChanged_signal_connect_cb_0(rsfptr:fn(f64), arg0: c_double) {
println!("{}:{}", file!(), line!());
let rsarg0 = arg0 as f64;
rsfptr(rsarg0);
}
extern fn QDoubleSpinBox_valueChanged_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(f64)>, arg0: c_double) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = arg0 as f64;
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QDoubleSpinBox_valueChanged_signal_connect for fn(f64) {
fn connect(self, sigthis: QDoubleSpinBox_valueChanged_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QDoubleSpinBox_valueChanged_signal_connect_cb_0 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QDoubleSpinBox_SlotProxy_connect__ZN14QDoubleSpinBox12valueChangedEd(arg0, arg1, arg2)};
}
}
impl /* trait */ QDoubleSpinBox_valueChanged_signal_connect for Box<Fn(f64)> {
fn connect(self, sigthis: QDoubleSpinBox_valueChanged_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QDoubleSpinBox_valueChanged_signal_connect_cb_box_0 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QDoubleSpinBox_SlotProxy_connect__ZN14QDoubleSpinBox12valueChangedEd(arg0, arg1, arg2)};
}
}
// valueChanged(const class QString &)
extern fn QDoubleSpinBox_valueChanged_signal_connect_cb_1(rsfptr:fn(QString), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QString::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
}
extern fn QDoubleSpinBox_valueChanged_signal_connect_cb_box_1(rsfptr_raw:*mut Box<Fn(QString)>, arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsfptr = unsafe{Box::from_raw(rsfptr_raw)};
let rsarg0 = QString::inheritFrom(arg0 as u64);
// rsfptr(rsarg0);
unsafe{(*rsfptr_raw)(rsarg0)};
}
impl /* trait */ QDoubleSpinBox_valueChanged_signal_connect for fn(QString) {
fn connect(self, sigthis: QDoubleSpinBox_valueChanged_signal) {
// do smth...
// self as u64; // error for Fn, Ok for fn
self as *mut c_void as u64;
self as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QDoubleSpinBox_valueChanged_signal_connect_cb_1 as *mut c_void;
let arg2 = self as *mut c_void;
unsafe {QDoubleSpinBox_SlotProxy_connect__ZN14QDoubleSpinBox12valueChangedERK7QString(arg0, arg1, arg2)};
}
}
impl /* trait */ QDoubleSpinBox_valueChanged_signal_connect for Box<Fn(QString)> {
fn connect(self, sigthis: QDoubleSpinBox_valueChanged_signal) {
// do smth...
// Box::into_raw(self) as u64;
// Box::into_raw(self) as *mut c_void;
let arg0 = sigthis.poi as *mut c_void;
let arg1 = QDoubleSpinBox_valueChanged_signal_connect_cb_box_1 as *mut c_void;
let arg2 = Box::into_raw(Box::new(self)) as *mut c_void;
unsafe {QDoubleSpinBox_SlotProxy_connect__ZN14QDoubleSpinBox12valueChangedERK7QString(arg0, arg1, arg2)};
}
}
// <= body block end
|
use core::ops::Try;
use uefi::runtime_services::RuntimeServices;
use color::*;
use kernel_proto::{Info, MemoryDescriptor};
use display::Display;
use console::{Console, set_console};
extern {
static _magic: usize;
static _info: *const Info;
}
#[no_mangle]
pub extern fn start_uefi() {
let magic = unsafe { _magic };
let info = unsafe { _info };
let resolutin_w = unsafe { (*info).width };
let resolutin_h = unsafe { (*info).height };
let AREA = resolutin_w * resolutin_h;
let vid_addr = unsafe { (*info).vid_addr };
let mut display = Display::new(vid_addr, resolutin_w, resolutin_h);
let mut console = Console::new(&mut display);
let map = unsafe { (*info).map_addr } as *const MemoryDescriptor;
set_console(&mut console);
enable_nxe_bit();
enable_write_protect_bit();
display.rect(0, 0, resolutin_w, resolutin_h, Color::rgb(0, 0, 0));
println!("SnowKernel {}", env!("CARGO_PKG_VERSION"));
panic!("Test panic");
}
// https://github.com/phil-opp/blog_os/blob/post_10/src/lib.rs
fn enable_nxe_bit() {
use x86_64::registers::msr::{IA32_EFER, rdmsr, wrmsr};
let nxe_bit = 1 << 11;
unsafe {
let efer = rdmsr(IA32_EFER);
wrmsr(IA32_EFER, efer | nxe_bit);
}
}
fn enable_write_protect_bit() {
use x86_64::registers::control_regs::{cr0, cr0_write, Cr0};
unsafe { cr0_write(cr0() | Cr0::WRITE_PROTECT) };
} |
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
use core::convert::TryFrom;
use core::ops::{Add, Sub};
use core::str::FromStr;
use displaydoc::Display;
use icu_locid::Locale;
use tinystr::TinyStr8;
#[derive(Display, Debug)]
pub enum DateTimeError {
#[displaydoc("{0}")]
Parse(core::num::ParseIntError),
#[displaydoc("{field} must be between 0-{max}")]
Overflow { field: &'static str, max: usize },
#[displaydoc("{field} must be between {min}-0")]
Underflow { field: &'static str, min: isize },
#[displaydoc("Failed to parse time-zone offset")]
InvalidTimeZoneOffset,
}
#[cfg(feature = "std")]
impl std::error::Error for DateTimeError {}
impl From<core::num::ParseIntError> for DateTimeError {
fn from(e: core::num::ParseIntError) -> Self {
DateTimeError::Parse(e)
}
}
/// Representation of a formattable calendar date. Supports dates in any calendar system that uses
/// solar days indexed by an era, year, month, and day.
///
/// All fields are optional. If a field is not present but is required when formatting, an error
/// result will be returned from the formatter.
///
/// All data represented in [`DateInput`] should be locale-agnostic.
pub trait DateInput {
/// Gets the era and year input.
fn year(&self) -> Option<Year>;
/// Gets the month input.
fn month(&self) -> Option<Month>;
/// Gets the day input.
fn day_of_month(&self) -> Option<DayOfMonth>;
/// Gets the weekday input.
fn iso_weekday(&self) -> Option<IsoWeekday>;
/// Gets information on the position of the day within the year.
fn day_of_year_info(&self) -> Option<DayOfYearInfo>;
}
/// Representation of a time of day according to ISO-8601 conventions. Always indexed from
/// midnight, regardless of calendar system.
///
/// All fields are optional. If a field is not present but is required when formatting, an error
/// result will be returned from the formatter.
///
/// All data represented in [`IsoTimeInput`] should be locale-agnostic.
pub trait IsoTimeInput {
/// Gets the hour input.
fn hour(&self) -> Option<IsoHour>;
/// Gets the minute input.
fn minute(&self) -> Option<IsoMinute>;
/// Gets the second input.
fn second(&self) -> Option<IsoSecond>;
/// Gets the fractional second input.
fn fraction(&self) -> Option<FractionalSecond>;
}
/// Representation of a formattable time zone.
///
/// Only the [`GmtOffset`] is required, since it is the final format fallback.
///
/// All data represented in [`TimeZoneInput`] should be locale-agnostic.
pub trait TimeZoneInput {
/// The GMT offset in Nanoseconds.
fn gmt_offset(&self) -> GmtOffset;
/// The IANA time-zone identifier.
/// TODO(#606) switch this to BCP-47 identifier.
fn time_zone_id(&self) -> Option<&str>;
/// The metazone identifier.
/// TODO(#528) switch to a compact, stable ID.
fn metazone_id(&self) -> Option<&str>;
/// The time variant (e.g. "daylight", "standard")
/// TODO(#619) use TinyStr for time variants.
fn time_variant(&self) -> Option<&TinyStr8>;
}
/// A combination of a formattable calendar date and ISO time.
pub trait DateTimeInput: DateInput + IsoTimeInput {}
/// A combination of a formattable calendar date, ISO time, and time zone.
pub trait ZonedDateTimeInput: TimeZoneInput + DateTimeInput {}
impl<T> DateTimeInput for T where T: DateInput + IsoTimeInput {}
impl<T> ZonedDateTimeInput for T where T: TimeZoneInput + DateTimeInput {}
/// A formattable calendar date and ISO time that takes the locale into account.
pub trait LocalizedDateTimeInput<T: DateTimeInput> {
/// A reference to this instance's [`DateTimeInput`].
fn datetime(&self) -> &T;
/// The year number according to week numbering.
///
/// For example, December 31, 2020 is part of the first week of 2021.
fn year_week(&self) -> Year;
/// The week of the month according to UTS 35.
fn week_of_month(&self) -> WeekOfMonth;
/// The week number of the year.
///
/// For example, December 31, 2020 is part of the first week of 2021.
fn week_of_year(&self) -> WeekOfYear;
/// TODO(#487): Implement flexible day periods.
fn flexible_day_period(&self);
}
pub(crate) struct DateTimeInputWithLocale<'data, T: DateTimeInput> {
data: &'data T,
_first_weekday: u8,
_anchor_weekday: u8,
}
impl<'data, T: DateTimeInput> DateTimeInputWithLocale<'data, T> {
pub fn new(data: &'data T, _locale: &Locale) -> Self {
Self {
data,
// TODO(#488): Implement week calculations.
_first_weekday: 1,
_anchor_weekday: 4,
}
}
}
pub(crate) struct ZonedDateTimeInputWithLocale<'data, T: ZonedDateTimeInput> {
data: &'data T,
_first_weekday: u8,
_anchor_weekday: u8,
}
impl<'data, T: ZonedDateTimeInput> ZonedDateTimeInputWithLocale<'data, T> {
pub fn new(data: &'data T, _locale: &Locale) -> Self {
Self {
data,
// TODO(#488): Implement week calculations.
_first_weekday: 1,
_anchor_weekday: 4,
}
}
}
impl<'data, T: DateTimeInput> LocalizedDateTimeInput<T> for DateTimeInputWithLocale<'data, T> {
fn datetime(&self) -> &T {
self.data
}
fn year_week(&self) -> Year {
todo!("#488")
}
fn week_of_month(&self) -> WeekOfMonth {
todo!("#488")
}
fn week_of_year(&self) -> WeekOfYear {
todo!("#488")
}
fn flexible_day_period(&self) {
todo!("#487")
}
}
impl<'data, T: ZonedDateTimeInput> LocalizedDateTimeInput<T>
for ZonedDateTimeInputWithLocale<'data, T>
{
fn datetime(&self) -> &T {
self.data
}
fn year_week(&self) -> Year {
todo!("#488")
}
fn week_of_month(&self) -> WeekOfMonth {
todo!("#488")
}
fn week_of_year(&self) -> WeekOfYear {
todo!("#488")
}
fn flexible_day_period(&self) {
todo!("#487")
}
}
/// TODO(#486): Implement era codes.
#[derive(Clone, Debug, PartialEq)]
pub struct Era(pub TinyStr8);
/// Representation of a formattable year.
#[derive(Clone, Debug, PartialEq)]
pub struct Year {
/// The era containing the year.
pub era: Era,
/// The year number in the current era (usually 1-based).
pub number: i32,
/// The related ISO year. This is normally the ISO (proleptic Gregorian) year having the greatest
/// overlap with the calendar year. It is used in certain date formatting patterns.
pub related_iso: i32,
}
/// TODO(#486): Implement month codes.
#[derive(Clone, Debug, PartialEq)]
pub struct MonthCode(pub TinyStr8);
/// Representation of a formattable month.
#[derive(Clone, Debug, PartialEq)]
pub struct Month {
/// A month number in a year. In normal years, this is usually the 1-based month index. In leap
/// years, this is what the month number would have been in a non-leap year.
///
/// For example:
///
/// - January = 1
/// - December = 12
/// - Adar, Adar I, and Adar II = 6
///
/// The `code` property is used to distinguish between unique months in leap years.
pub number: u32,
/// The month code, used to distinguish months during leap years.
pub code: MonthCode,
}
#[derive(Clone, Debug, PartialEq)]
pub struct DayOfYearInfo {
pub day_of_year: u32,
pub days_in_year: u32,
pub prev_year: Year,
pub next_year: Year,
}
/// A weekday in a 7-day week, according to ISO-8601.
///
/// The discriminant values correspond to ISO-8601 weekday numbers (Monday = 1, Sunday = 7).
///
/// # Examples
///
/// ```
/// use icu::datetime::date::IsoWeekday;
///
/// assert_eq!(1, IsoWeekday::Monday as usize);
/// assert_eq!(7, IsoWeekday::Sunday as usize);
/// ```
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(i8)]
pub enum IsoWeekday {
Monday = 1,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday,
}
impl From<usize> for IsoWeekday {
/// Convert from an ISO-8601 weekday number to an [`IsoWeekday`] enum. 0 is automatically converted
/// to 7 (Sunday). If the number is out of range, it is interpreted modulo 7.
///
/// # Examples
///
/// ```
/// use icu::datetime::date::IsoWeekday;
///
/// assert_eq!(IsoWeekday::Sunday, IsoWeekday::from(0));
/// assert_eq!(IsoWeekday::Monday, IsoWeekday::from(1));
/// assert_eq!(IsoWeekday::Sunday, IsoWeekday::from(7));
/// assert_eq!(IsoWeekday::Monday, IsoWeekday::from(8));
/// ```
fn from(input: usize) -> Self {
let mut ordinal = (input % 7) as i8;
if ordinal == 0 {
ordinal = 7;
}
unsafe { core::mem::transmute(ordinal) }
}
}
/// A day number in a month. Usually 1-based.
pub struct DayOfMonth(pub u32);
/// A week number in a month. Usually 1-based.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct WeekOfMonth(pub u32);
/// A week number in a year. Usually 1-based.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct WeekOfYear(pub u32);
/// This macro defines a struct for 0-based date fields: hours, minutes, and seconds. Each
/// unit is bounded by a range. The traits implemented here will return a Result on
/// whether or not the unit is in range from the given input.
macro_rules! dt_unit {
($name:ident, $value:expr) => {
#[derive(Debug, Default, Clone, Copy, PartialEq, Hash)]
pub struct $name(u8);
impl $name {
pub const fn new_unchecked(input: u8) -> Self {
Self(input)
}
}
impl FromStr for $name {
type Err = DateTimeError;
fn from_str(input: &str) -> Result<Self, Self::Err> {
let val: u8 = input.parse()?;
if val > $value {
Err(DateTimeError::Overflow {
field: "$name",
max: $value,
})
} else {
Ok(Self(val))
}
}
}
impl TryFrom<u8> for $name {
type Error = DateTimeError;
fn try_from(input: u8) -> Result<Self, Self::Error> {
if input > $value {
Err(DateTimeError::Overflow {
field: "$name",
max: $value,
})
} else {
Ok(Self(input))
}
}
}
impl TryFrom<usize> for $name {
type Error = DateTimeError;
fn try_from(input: usize) -> Result<Self, Self::Error> {
if input > $value {
Err(DateTimeError::Overflow {
field: "$name",
max: $value,
})
} else {
Ok(Self(input as u8))
}
}
}
impl From<$name> for u8 {
fn from(input: $name) -> Self {
input.0
}
}
impl From<$name> for usize {
fn from(input: $name) -> Self {
input.0 as Self
}
}
impl Add<u8> for $name {
type Output = Self;
fn add(self, other: u8) -> Self {
Self(self.0 + other)
}
}
impl Sub<u8> for $name {
type Output = Self;
fn sub(self, other: u8) -> Self {
Self(self.0 - other)
}
}
};
}
dt_unit!(IsoHour, 24);
dt_unit!(IsoMinute, 60);
dt_unit!(IsoSecond, 61);
// TODO(#485): Improve FractionalSecond.
#[derive(Clone, Debug, PartialEq)]
pub enum FractionalSecond {
Millisecond(u16),
Microsecond(u32),
Nanosecond(u32),
}
/// The GMT offset in seconds for a [`MockTimeZone`](crate::mock::time_zone::MockTimeZone).
#[derive(Copy, Clone, Debug, Default)]
pub struct GmtOffset(i32);
impl GmtOffset {
pub fn try_new(seconds: i32) -> Result<Self, DateTimeError> {
// Valid range is from GMT-12 to GMT+14 in seconds.
if seconds < -(12 * 60 * 60) {
Err(DateTimeError::Underflow {
field: "GmtOffset",
min: -(12 * 60 * 60),
})
} else if seconds > (14 * 60 * 60) {
Err(DateTimeError::Overflow {
field: "GmtOffset",
max: (14 * 60 * 60),
})
} else {
Ok(Self(seconds))
}
}
/// Returns the raw offset value in seconds.
pub fn raw_offset_seconds(&self) -> i32 {
self.0
}
/// Returns `true` if the [`GmtOffset`] is positive, otherwise `false`.
pub fn is_positive(&self) -> bool {
self.0 >= 0
}
/// Returns `true` if the [`GmtOffset`] is zero, otherwise `false`.
pub fn is_zero(&self) -> bool {
self.0 == 0
}
/// Returns `true` if the [`GmtOffset`] has non-zero minutes, otherwise `false`.
pub fn has_minutes(&self) -> bool {
self.0 % 3600 / 60 > 0
}
/// Returns `true` if the [`GmtOffset`] has non-zero seconds, otherwise `false`.
pub fn has_seconds(&self) -> bool {
self.0 % 3600 % 60 > 0
}
}
impl FromStr for GmtOffset {
type Err = DateTimeError;
/// Parse a [`GmtOffset`] from a string.
///
/// The offset must range from GMT-12 to GMT+14.
/// The string must be an ISO 8601 time zone designator:
/// e.g. Z
/// e.g. +05
/// e.g. +0500
/// e.g. +05:00
///
/// # Examples
///
/// ```
/// use icu::datetime::date::GmtOffset;
///
/// let offset0: GmtOffset = "Z".parse().expect("Failed to parse a GMT offset.");
/// let offset1: GmtOffset = "-09".parse().expect("Failed to parse a GMT offset.");
/// let offset2: GmtOffset = "-0930".parse().expect("Failed to parse a GMT offset.");
/// let offset3: GmtOffset = "-09:30".parse().expect("Failed to parse a GMT offset.");
/// ```
fn from_str(input: &str) -> Result<Self, Self::Err> {
let offset_sign;
match input.chars().next() {
Some('+') => offset_sign = 1,
/* ASCII */ Some('-') => offset_sign = -1,
/* U+2212 */ Some('−') => offset_sign = -1,
Some('Z') => return Ok(Self(0)),
_ => return Err(DateTimeError::InvalidTimeZoneOffset),
};
let seconds = match input.chars().count() {
/* ±hh */
3 => {
let hour: u8 = input[1..3].parse()?;
offset_sign * (hour as i32 * 60 * 60)
}
/* ±hhmm */
5 => {
let hour: u8 = input[1..3].parse()?;
let minute: u8 = input[3..5].parse()?;
offset_sign * (hour as i32 * 60 * 60 + minute as i32 * 60)
}
/* ±hh:mm */
6 => {
let hour: u8 = input[1..3].parse()?;
let minute: u8 = input[4..6].parse()?;
offset_sign * (hour as i32 * 60 * 60 + minute as i32 * 60)
}
_ => panic!("Invalid time-zone designator"),
};
Self::try_new(seconds)
}
}
|
use std::fs;
fn part_1(time_arrival: &u32, bus_ids: &Vec<u32>) -> u32 {
let times: Vec<(&u32, u32)> = bus_ids
.into_iter()
.map(|bus_id| (bus_id, bus_id - (time_arrival % bus_id)))
.collect();
let mut min: (&u32, u32) = (&0, u32::max_value());
for time in times {
if time.1 < min.1 {
min = time;
}
}
min.0 * min.1
}
fn part_2(second_line: &str) -> u64 {
let mut t: u64 = 0;
let mut step = 1;
let raw_ids: Vec<&str> = second_line.split(",").collect();
let mut bus_ids = vec![];
for i in 0..raw_ids.len() {
let id = raw_ids[i];
if id != "x" {
bus_ids.push((id.parse::<u64>().unwrap(), i as u64));
}
}
for (bus_id, mins) in bus_ids {
while (t + mins) % bus_id != 0 {
t += step;
}
step *= bus_id;
}
t
}
fn main() {
let path = "src/input.txt";
let file_content = fs::read_to_string(path).unwrap();
let first_line = file_content.lines().nth(0).unwrap();
let second_line = file_content.lines().nth(1).unwrap();
let time_arrival = first_line.parse::<u32>().unwrap();
let bus_ids: Vec<u32> = second_line
.split(",")
.filter(|it| it != &"x")
.map(|it| it.parse::<u32>().unwrap())
.collect();
let result_part1 = part_1(&time_arrival, &bus_ids);
println!("Result part 1: {}", result_part1);
let result_part2 = part_2(&second_line);
println!("Result part 2: {}", result_part2);
}
|
use crate::prelude::*;
use nannou::geom::Tri;
pub trait TrianglesExtension {
fn subdivide(
self,
rand: &mut Rand,
num_subdivisions: usize,
min_skew: NormalizedF32,
max_skew: NormalizedF32,
) -> Vec<Tri<Point2>>;
}
impl TrianglesExtension for Vec<Tri<Point2>> {
fn subdivide(
self,
rand: &mut Rand,
num_subdivisions: usize,
min_skew: NormalizedF32,
max_skew: NormalizedF32,
) -> Vec<Tri<Point2>> {
if num_subdivisions == 0 {
return self;
}
let mut to_subdivide = self;
if num_subdivisions > to_subdivide.capacity() {
let additional_allocations_required = num_subdivisions - to_subdivide.capacity();
to_subdivide.reserve(additional_allocations_required);
}
let mut already_subdivided = Vec::with_capacity(num_subdivisions * 2);
for _ in 0..num_subdivisions {
let index = rand.index(&to_subdivide);
let triangle = to_subdivide.swap_remove(index);
let new_triangles = triangle.subdivide_once(rand, min_skew, max_skew);
to_subdivide.push(new_triangles[0]);
to_subdivide.push(new_triangles[1]);
already_subdivided.push(triangle);
}
already_subdivided.append(&mut to_subdivide);
already_subdivided
}
}
|
use regex::Regex;
use crate::emulator::{Vm, VmState};
use std::{
collections::{hash_map::DefaultHasher, BTreeMap, HashSet},
hash::{Hash, Hasher},
};
pub struct GameSolver {}
impl GameSolver {
pub fn explore_maze(vm: &Vm) {
let message = vm.get_messages().last().unwrap();
let level = Level::from(message).unwrap();
let first_level = level.clone();
let mut explored: HashSet<Level> = Default::default();
let mut queue: BTreeMap<Level, Vm> = Default::default();
queue.insert(level, vm.clone());
let mut graphviz = String::from("digraph G {\n");
while let Some((current_level, current_vm)) = queue.pop_first() {
if explored.contains(¤t_level) {
continue;
}
//dbg!(explored.len(), queue.len());
//println!("Exploring {}", current_level.name);
for exit in ¤t_level.exits {
let mut vm = current_vm.clone();
vm.feed(exit).unwrap();
vm.run();
if vm.get_state() == VmState::Halted {
continue;
}
let message = vm.get_messages().last().unwrap();
let new_level = match Level::from(message) {
Ok(l) => l,
Err(_) => Level {
name: "custom level".into(),
description: message.to_string(),
exits: Vec::new(),
things: Vec::new(),
},
};
//println!("exit {} => {}", exit, new_level.name);
fn hash_string(input: &str) -> u64 {
let mut hasher = DefaultHasher::new();
input.hash(&mut hasher);
hasher.finish()
}
let from = hash_string(&format!(
"{}{}",
current_level.name, current_level.description
));
let to = hash_string(&format!("{}{}", new_level.name, new_level.description));
let things = current_level.things.join(" ");
let color = if current_level.things.is_empty() {
"black"
} else {
"red"
};
let shape = if current_level == first_level {
"Mdiamond"
} else {
"ellipse"
};
graphviz.push_str(&format!("{} -> {} [label =\"{}\"];\n", from, to, exit));
#[allow(clippy::format_in_format_args)]
graphviz.push_str(&format!(
"{} [label=\"{} - {}: {}\", color = {}, shape = {}];\n",
from,
current_level.name,
current_level.description.replace('\"', ""),
things,
color,
shape
));
if explored.contains(&new_level) {
continue;
}
queue.insert(new_level, vm.clone());
}
explored.insert(current_level);
}
println!("Finished exploring");
for level in &explored {
println!("{}", level.name);
for thing in &level.things {
println!("- {}", thing);
}
}
graphviz.push_str("}\n\n");
match std::fs::write("graphviz.dot", graphviz) {
Ok(_) => (),
Err(x) => println!("{:?}", x),
}
println!("./graphviz.dot");
}
pub fn trace_teleporter(vm: &Vm) {
for val in 43000..u16::MAX {
dbg!(val);
let mut vm = vm.clone();
//vm.set_traced_opcodes(Opcode::Call(Val::Invalid).discriminant());
vm.set_patching(true);
vm.set_register(7, val);
let _ = vm.feed("use teleporter");
let mut steps = 10000000;
while vm.get_state() == VmState::Running {
match vm.step() {
Ok(()) => (),
Err(_e) => break,
}
steps -= 1;
if steps == 0 {
println!("early stop {}", val);
break;
}
}
//Vm::pretty_print_dis(&vm.get_trace_buffer());
if vm.get_state() == VmState::WaitingForInput {
dbg!(&vm.get_messages().last());
panic!("{}", val);
}
}
}
}
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Level {
pub name: String,
pub description: String,
pub things: Vec<String>,
pub exits: Vec<String>,
}
impl Level {
pub fn from(raw: &str) -> Result<Self, Box<dyn std::error::Error>> {
let re_name = Regex::new(r"== (.+?) ==\n(.+?)\n").unwrap();
let (name, mut description) = {
let caps = re_name.captures(raw).ok_or("No level name")?;
(
caps.get(1).unwrap().as_str().to_string(),
caps.get(2).unwrap().as_str().to_string(),
)
};
if description.contains("You are in a grid of rooms that control the door to the vault.") {
description.push_str(raw.lines().nth(5).unwrap());
description = description.replace('\n', " ");
}
fn get_things(raw: &str) -> Vec<String> {
let re_things = Regex::new(r"Things of interest here:\n([^\n]+\n)+").unwrap();
let things_str = match re_things.captures(raw) {
Some(x) => x.get(0).unwrap().as_str().to_string(),
None => return Vec::new(),
};
let things = things_str
.lines()
.skip(1)
.map(|line| line.get(2..).unwrap().to_string())
.collect::<Vec<_>>();
things
}
let things = get_things(raw);
fn get_exits(raw: &str) -> Vec<String> {
let re_exits = Regex::new(r"(?s)There \w+ \d+ exits?:\n([^\n]+\n)+").unwrap();
let exits_str = match re_exits.captures(raw) {
Some(x) => x.get(0).unwrap().as_str().to_string(),
None => return Vec::new(),
};
let exits = exits_str
.lines()
.skip(1)
.map(|line| line.get(2..).unwrap().to_string())
.collect::<Vec<_>>();
exits
}
let exits = get_exits(raw);
let level = Level {
description,
name,
things,
exits,
};
Ok(level)
}
}
|
// Copyright 2020, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
use super::{
database::{NewStoredMessage, StoreAndForwardDatabase, StoredMessage},
message::StoredMessagePriority,
SafResult,
StoreAndForwardError,
};
use crate::{
envelope::DhtMessageType,
outbound::{OutboundMessageRequester, SendMessageParams},
proto::store_forward::{stored_messages_response::SafResponseType, StoredMessagesRequest},
storage::{DbConnection, DhtMetadataKey},
DhtConfig,
DhtRequester,
};
use chrono::{DateTime, NaiveDateTime, Utc};
use futures::{
channel::{mpsc, oneshot},
stream::Fuse,
SinkExt,
StreamExt,
};
use log::*;
use std::{convert::TryFrom, sync::Arc, time::Duration};
use tari_comms::{
connection_manager::ConnectionManagerRequester,
peer_manager::{node_id::NodeDistance, NodeId, PeerFeatures},
types::CommsPublicKey,
ConnectionManagerEvent,
NodeIdentity,
PeerManager,
};
use tari_shutdown::ShutdownSignal;
use tari_utilities::ByteArray;
use tokio::{sync::broadcast, task, time};
const LOG_TARGET: &str = "comms::dht::storeforward::actor";
/// The interval to initiate a database cleanup.
/// This involves cleaning up messages which have been stored too long according to their priority
const CLEANUP_INTERVAL: Duration = Duration::from_secs(10 * 60); // 10 mins
#[derive(Debug, Clone)]
pub struct FetchStoredMessageQuery {
public_key: Box<CommsPublicKey>,
node_id: Box<NodeId>,
since: Option<DateTime<Utc>>,
dist_threshold: Option<Box<NodeDistance>>,
response_type: SafResponseType,
}
impl FetchStoredMessageQuery {
pub fn new(public_key: Box<CommsPublicKey>, node_id: Box<NodeId>) -> Self {
Self {
public_key,
node_id,
since: None,
response_type: SafResponseType::Anonymous,
dist_threshold: None,
}
}
pub fn since(&mut self, since: DateTime<Utc>) -> &mut Self {
self.since = Some(since);
self
}
pub fn with_response_type(&mut self, response_type: SafResponseType) -> &mut Self {
self.response_type = response_type;
self
}
pub fn with_dist_threshold(&mut self, dist_threshold: Box<NodeDistance>) -> &mut Self {
self.dist_threshold = Some(dist_threshold);
self
}
}
#[derive(Debug)]
pub enum StoreAndForwardRequest {
FetchMessages(FetchStoredMessageQuery, oneshot::Sender<SafResult<Vec<StoredMessage>>>),
InsertMessage(NewStoredMessage),
SendStoreForwardRequestToPeer(Box<NodeId>),
SendStoreForwardRequestNeighbours,
}
#[derive(Clone)]
pub struct StoreAndForwardRequester {
sender: mpsc::Sender<StoreAndForwardRequest>,
}
impl StoreAndForwardRequester {
pub fn new(sender: mpsc::Sender<StoreAndForwardRequest>) -> Self {
Self { sender }
}
pub async fn fetch_messages(&mut self, request: FetchStoredMessageQuery) -> SafResult<Vec<StoredMessage>> {
let (reply_tx, reply_rx) = oneshot::channel();
self.sender
.send(StoreAndForwardRequest::FetchMessages(request, reply_tx))
.await
.map_err(|_| StoreAndForwardError::RequesterChannelClosed)?;
reply_rx.await.map_err(|_| StoreAndForwardError::RequestCancelled)?
}
pub async fn insert_message(&mut self, message: NewStoredMessage) -> SafResult<()> {
self.sender
.send(StoreAndForwardRequest::InsertMessage(message))
.await
.map_err(|_| StoreAndForwardError::RequesterChannelClosed)?;
Ok(())
}
pub async fn request_saf_messages_from_peer(&mut self, node_id: NodeId) -> SafResult<()> {
self.sender
.send(StoreAndForwardRequest::SendStoreForwardRequestToPeer(Box::new(node_id)))
.await
.map_err(|_| StoreAndForwardError::RequesterChannelClosed)?;
Ok(())
}
pub async fn request_saf_messages_from_neighbours(&mut self) -> SafResult<()> {
self.sender
.send(StoreAndForwardRequest::SendStoreForwardRequestNeighbours)
.await
.map_err(|_| StoreAndForwardError::RequesterChannelClosed)?;
Ok(())
}
}
pub struct StoreAndForwardService {
config: DhtConfig,
node_identity: Arc<NodeIdentity>,
dht_requester: DhtRequester,
database: StoreAndForwardDatabase,
peer_manager: Arc<PeerManager>,
connection_events: Fuse<broadcast::Receiver<Arc<ConnectionManagerEvent>>>,
outbound_requester: OutboundMessageRequester,
request_rx: Fuse<mpsc::Receiver<StoreAndForwardRequest>>,
shutdown_signal: Option<ShutdownSignal>,
}
impl StoreAndForwardService {
pub fn new(
config: DhtConfig,
conn: DbConnection,
node_identity: Arc<NodeIdentity>,
peer_manager: Arc<PeerManager>,
dht_requester: DhtRequester,
connection_manager: ConnectionManagerRequester,
outbound_requester: OutboundMessageRequester,
request_rx: mpsc::Receiver<StoreAndForwardRequest>,
shutdown_signal: ShutdownSignal,
) -> Self
{
Self {
config,
database: StoreAndForwardDatabase::new(conn),
node_identity,
peer_manager,
dht_requester,
request_rx: request_rx.fuse(),
connection_events: connection_manager.get_event_subscription().fuse(),
outbound_requester,
shutdown_signal: Some(shutdown_signal),
}
}
pub async fn spawn(self) -> SafResult<()> {
info!(target: LOG_TARGET, "Store and forward service started");
task::spawn(Self::run(self));
Ok(())
}
async fn run(mut self) {
let mut shutdown_signal = self
.shutdown_signal
.take()
.expect("StoreAndForwardActor initialized without shutdown_signal");
let mut cleanup_ticker = time::interval(CLEANUP_INTERVAL).fuse();
loop {
futures::select! {
request = self.request_rx.select_next_some() => {
self.handle_request(request).await;
},
event = self.connection_events.select_next_some() => {
if let Ok(event) = event {
if let Err(err) = self.handle_connection_manager_event(&event).await {
error!(target: LOG_TARGET, "Error handling connection manager event: {:?}", err);
}
}
},
_ = cleanup_ticker.select_next_some() => {
if let Err(err) = self.cleanup().await {
error!(target: LOG_TARGET, "Error when performing store and forward cleanup: {:?}", err);
}
},
_ = shutdown_signal => {
info!(target: LOG_TARGET, "StoreAndForwardActor is shutting down because the shutdown signal was triggered");
break;
}
}
}
}
async fn handle_request(&mut self, request: StoreAndForwardRequest) {
use StoreAndForwardRequest::*;
trace!(target: LOG_TARGET, "Request: {:?}", request);
match request {
FetchMessages(query, reply_tx) => match self.handle_fetch_message_query(query).await {
Ok(messages) => {
let _ = reply_tx.send(Ok(messages));
},
Err(err) => {
error!(
target: LOG_TARGET,
"Failed to fetch stored messages because '{:?}'", err
);
let _ = reply_tx.send(Err(err));
},
},
InsertMessage(msg) => {
let public_key = msg.destination_pubkey.clone();
let node_id = msg.destination_node_id.clone();
match self.database.insert_message(msg).await {
Ok(_) => info!(
target: LOG_TARGET,
"Stored message for {}",
public_key
.map(|p| format!("public key '{}'", p))
.or_else(|| node_id.map(|n| format!("node id '{}'", n)))
.unwrap_or_else(|| "<Anonymous>".to_string())
),
Err(err) => {
error!(target: LOG_TARGET, "InsertMessage failed because '{:?}'", err);
},
}
},
SendStoreForwardRequestToPeer(node_id) => {
if let Err(err) = self.request_stored_messages_from_peer(&node_id).await {
error!(target: LOG_TARGET, "Error sending store and forward request: {:?}", err);
}
},
SendStoreForwardRequestNeighbours => {
if let Err(err) = self.request_stored_messages_neighbours().await {
error!(
target: LOG_TARGET,
"Error sending store and forward request to neighbours: {:?}", err
);
}
},
}
}
async fn handle_connection_manager_event(&mut self, event: &ConnectionManagerEvent) -> SafResult<()> {
use ConnectionManagerEvent::*;
if !self.config.saf_auto_request {
debug!(
target: LOG_TARGET,
"Auto store and forward request disabled. Ignoring connection manager event"
);
return Ok(());
}
match event {
PeerConnected(conn) => {
// Whenever we connect to a peer, request SAF messages
let features = self.peer_manager.get_peer_features(conn.peer_node_id()).await?;
if features.contains(PeerFeatures::DHT_STORE_FORWARD) {
info!(
target: LOG_TARGET,
"Connected peer '{}' is a SAF node. Requesting stored messages.",
conn.peer_node_id().short_str()
);
self.request_stored_messages_from_peer(conn.peer_node_id()).await?;
}
},
_ => {},
}
Ok(())
}
async fn request_stored_messages_from_peer(&mut self, node_id: &NodeId) -> SafResult<()> {
let request = self.get_saf_request().await?;
info!(
target: LOG_TARGET,
"Sending store and forward request to peer '{}' (Since = {:?})", node_id, request.since
);
self.outbound_requester
.send_message_no_header(
SendMessageParams::new()
.direct_node_id(node_id.clone())
.with_dht_message_type(DhtMessageType::SafRequestMessages)
.finish(),
request,
)
.await
.map_err(StoreAndForwardError::RequestMessagesFailed)?;
Ok(())
}
async fn request_stored_messages_neighbours(&mut self) -> SafResult<()> {
let request = self.get_saf_request().await?;
info!(
target: LOG_TARGET,
"Sending store and forward request to neighbours (Since = {:?})", request.since
);
self.outbound_requester
.send_message_no_header(
SendMessageParams::new()
.neighbours(vec![])
.with_dht_message_type(DhtMessageType::SafRequestMessages)
.finish(),
request,
)
.await
.map_err(StoreAndForwardError::RequestMessagesFailed)?;
Ok(())
}
async fn get_saf_request(&mut self) -> SafResult<StoredMessagesRequest> {
let mut request = self
.dht_requester
.get_metadata(DhtMetadataKey::OfflineTimestamp)
.await?
.map(StoredMessagesRequest::since)
.unwrap_or_else(StoredMessagesRequest::new);
// Calculate the network region threshold for our node id.
// i.e. "Give me all messages that are this close to my node ID"
let threshold = self
.peer_manager
.calc_region_threshold(
self.node_identity.node_id(),
self.config.num_neighbouring_nodes,
PeerFeatures::DHT_STORE_FORWARD,
)
.await?;
request.dist_threshold = threshold.to_vec();
Ok(request)
}
async fn handle_fetch_message_query(&self, query: FetchStoredMessageQuery) -> SafResult<Vec<StoredMessage>> {
use SafResponseType::*;
let limit = i64::try_from(self.config.saf_max_returned_messages)
.ok()
.or(Some(std::i64::MAX))
.unwrap();
let db = &self.database;
let messages = match query.response_type {
ForMe => {
db.find_messages_for_peer(&query.public_key, &query.node_id, query.since, limit)
.await?
},
Join => db.find_join_messages(query.since, limit).await?,
Discovery => {
db.find_messages_of_type_for_pubkey(&query.public_key, DhtMessageType::Discovery, query.since, limit)
.await?
},
Anonymous => db.find_anonymous_messages(query.since, limit).await?,
InRegion => {
db.find_regional_messages(&query.node_id, query.dist_threshold, query.since, limit)
.await?
},
};
Ok(messages)
}
async fn cleanup(&self) -> SafResult<()> {
let num_removed = self
.database
.delete_messages_with_priority_older_than(
StoredMessagePriority::Low,
since(self.config.saf_low_priority_msg_storage_ttl),
)
.await?;
info!(target: LOG_TARGET, "Cleaned {} old low priority messages", num_removed);
let num_removed = self
.database
.delete_messages_with_priority_older_than(
StoredMessagePriority::High,
since(self.config.saf_high_priority_msg_storage_ttl),
)
.await?;
info!(target: LOG_TARGET, "Cleaned {} old high priority messages", num_removed);
Ok(())
}
}
fn since(period: Duration) -> NaiveDateTime {
use chrono::Duration as OldDuration;
let period = OldDuration::from_std(period).expect("period was out of range for chrono::Duration");
Utc::now()
.naive_utc()
.checked_sub_signed(period)
.expect("period overflowed when used with checked_sub_signed")
}
|
use proconio::input;
fn main() {
input! {
n: usize,
a: [u32; n],
};
let min = a.iter().min().copied().unwrap();
let max = a.iter().max().copied().unwrap();
assert_eq!(max - min, n as u32);
for x in min..=max {
if a.contains(&x) == false {
println!("{}", x);
return;
}
}
unreachable!();
}
|
use super::{
partitioner::PartitionError, retention_validation::RetentionError, RpcWriteError, SchemaError,
};
use async_trait::async_trait;
use data_types::{NamespaceName, NamespaceSchema};
use std::{error::Error, fmt::Debug, sync::Arc};
use thiserror::Error;
use trace::ctx::SpanContext;
/// Errors emitted by a [`DmlHandler`] implementation during DML request
/// processing.
#[derive(Debug, Error)]
pub enum DmlError {
/// The namespace specified by the caller does not exist.
#[error("namespace {0} does not exist")]
NamespaceNotFound(String),
/// An error pushing the request to a downstream ingester via a direct RPC
/// call.
#[error(transparent)]
RpcWrite(#[from] RpcWriteError),
/// A schema validation failure.
#[error(transparent)]
Schema(#[from] SchemaError),
/// An error partitioning the request.
#[error(transparent)]
Partition(#[from] PartitionError),
/// An error validate retention period
#[error(transparent)]
Retention(#[from] RetentionError),
/// An unknown error occured while processing the DML request.
#[error("internal dml handler error: {0}")]
Internal(Box<dyn Error + Send + Sync>),
}
/// A composable, abstract handler of DML requests.
#[async_trait]
pub trait DmlHandler: Debug + Send + Sync {
/// The input type this handler expects for a DML write.
///
/// By allowing handlers to vary their input type, it is possible to
/// construct a chain of [`DmlHandler`] implementations that transform the
/// input request as it progresses through the handler pipeline.
type WriteInput: Debug + Send + Sync;
/// The (possibly transformed) output type returned by this handler after
/// processing a write.
type WriteOutput: Debug + Send + Sync;
/// The type of error a [`DmlHandler`] implementation produces for write
/// requests.
///
/// All errors must be mappable into the concrete [`DmlError`] type.
type WriteError: Error + Into<DmlError> + Send;
/// Write `batches` to `namespace`.
async fn write(
&self,
namespace: &NamespaceName<'static>,
namespace_schema: Arc<NamespaceSchema>,
input: Self::WriteInput,
span_ctx: Option<SpanContext>,
) -> Result<Self::WriteOutput, Self::WriteError>;
}
#[async_trait]
impl<T> DmlHandler for Arc<T>
where
T: DmlHandler,
{
type WriteInput = T::WriteInput;
type WriteOutput = T::WriteOutput;
type WriteError = T::WriteError;
async fn write(
&self,
namespace: &NamespaceName<'static>,
namespace_schema: Arc<NamespaceSchema>,
input: Self::WriteInput,
span_ctx: Option<SpanContext>,
) -> Result<Self::WriteOutput, Self::WriteError> {
(**self)
.write(namespace, namespace_schema, input, span_ctx)
.await
}
}
|
mod program;
mod vertex_array;
mod buffer;
mod primitive_type;
mod filter;
mod wrap;
mod texture;
mod attachment;
mod framebuffer;
pub use program::{ProgramId, Program};
pub use vertex_array::{VertexArrayId, VertexArray};
pub use buffer::{BufferTarget, BufferUsage, BufferId, Buffer, VertexBuffer, ElementBuffer};
pub use primitive_type::PrimitiveType;
pub use filter::{FilterMode, Filter};
pub use wrap::{WrapMode, Wrap};
pub use texture::{TextureId, Texture};
pub use attachment::Attachment;
pub use framebuffer::{FramebufferId, Framebuffer};
|
/*!
# Why is this here?
Because *both* Cargo and Rust both know better than I do and won't let me tell them to stop running the tests in parallel. This is a problem because they do not, in fact, know better than me: Cargo doesn't do *any* locking, which causes random failures as two tests try to update the registry simultaneously (quite *why* Cargo needs to update the registry so fucking often I have no damn idea).
*All* integration tests have to be glommed into a single runner so that we can use locks to prevent Cargo from falling over and breaking both its legs as soon as a gentle breeze comes along. I *would* do this "properly" using file locks, except that's apparently impossible in Rust without writing the whole stack yourself directly on native OS calls, and I just can't be arsed to go to *that* much effort just to get some bloody tests to work.
*/
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate scan_rules;
#[macro_use]
mod util;
mod tests {
mod expr;
mod script;
mod version;
}
|
use std::io;
use std::io::Write;
struct Baby {
name: String,
past_weight: i32,
present_weight: i32,
}
impl Baby {
fn new(name: String, past_weight: i32, present_weight: i32) -> Self {
Self { name, past_weight, present_weight }
}
}
fn main() {
// let mut data: Vec<Baby> = Vec::new();
let ask_cnt: &str = prompt("Masukan jumlah data yang akan di input: ");
// let cnt: i32 = ask_cnt.parse::<i32>().unwrap();
println!("{:?}", ask_cnt);
// for _x in 0..cnt {
// let name = prompt("Masukan nama bayi: ");
// let old_weight = prompt("Masukan berat lama: ");
// let new_weight = prompt("Masukan berat sekarang: ");
// let baby = Baby {
// name: name,
// past_weight: old_weight.parse::<i32>().unwrap(),
// present_weight: new_weight.parse::<i32>().unwrap(),
// };
// data.push(baby);
// br(None);
// }
// println!("Name\tBerat1\tBerat2");
// for b in data {
// println!("{}\t{}\t{}", b.name, b.past_weight, b.present_weight);
// }
}
fn prompt<T>(title: &str) -> T {
print!("{}", title);
io::stdout().flush().unwrap();
let mut name = String::new();
io::stdin().read_line(&mut name).unwrap();
name.parse::<T>().unwrap()
}
fn br(col: Option<i32>) {
let col_num = match col {
Some(val) => val,
None => 80,
};
for _i in 0..col_num {
print!("-");
}
print!("\n");
}
|
// Copyright 2020-2021, The Tremor Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![cfg(not(tarpaulin_include))]
//! # Kafka Offramp
//!
//! The `kafka` offramp allows persisting events to a kafka queue.
//!
//! ## Configuration
//!
//! See [Config](struct.Config.html) for details.
use crate::sink::prelude::*;
use async_channel::{bounded, Receiver, Sender};
use halfbrown::HashMap;
use rdkafka::config::ClientConfig;
use rdkafka::error::RDKafkaError;
use rdkafka::producer::Producer;
use rdkafka::{
error::KafkaError,
message::OwnedHeaders,
producer::{FutureProducer, FutureRecord},
};
use std::{
fmt,
time::{Duration, Instant},
};
#[derive(Deserialize)]
pub struct Config {
/// list of brokers
pub brokers: Vec<String>,
/// the topic to send to
pub topic: String,
/// a map (string keys and string values) of [librdkafka options](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md) (default: None) - Note this can overwrite default settings.
///
/// Default settings for librdkafka:
///
/// * `client.id` - `"tremor-<hostname>-0"`
/// * `bootstrap.servers` - `brokers` from the config concatinated by `,`
/// * `message.timeout.ms` - `"5000"`
/// * `queue.buffering.max.ms` - `"0"` - don't buffer for lower latency (high)
#[serde(default = "Default::default")]
pub rdkafka_options: HashMap<String, String>,
/// hostname to use, defaults to the hostname of the system
#[serde(default = "d_host")]
pub hostname: String,
/// key to use for messages, defaults to none
#[serde(default = "Default::default")]
pub key: Option<String>,
}
impl Config {
fn producer(&self) -> Result<FutureProducer> {
let mut producer_config = ClientConfig::new();
// ENABLE LIBRDKAFKA DEBUGGING:
// - set librdkafka logger to debug in logger.yaml
// - configure: debug: "all" for this onramp
let producer_config = producer_config
.set("client.id", &format!("tremor-{}-{}", self.hostname, 0))
.set("bootstrap.servers", &self.brokers.join(","))
.set("message.timeout.ms", "5000")
.set("queue.buffering.max.ms", "0"); // set to 0 for sending each message out immediately without kafka client internal batching --> low latency, busy network
Ok(self
.rdkafka_options
.iter()
.fold(producer_config, |c: &mut ClientConfig, (k, v)| c.set(k, v))
.create()?)
}
}
impl ConfigImpl for Config {}
fn d_host() -> String {
hostname()
}
/// Kafka offramp connectoz
pub struct Kafka {
sink_url: TremorUrl,
config: Config,
producer: FutureProducer,
postprocessors: Postprocessors,
reply_tx: Sender<sink::Reply>,
error_rx: Receiver<RDKafkaError>,
error_tx: Sender<RDKafkaError>,
}
impl fmt::Debug for Kafka {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "[Sink::{}] Kafka: {}", &self.sink_url, self.config.topic)
}
}
impl offramp::Impl for Kafka {
fn from_config(config: &Option<OpConfig>) -> Result<Box<dyn Offramp>> {
if let Some(config) = config {
let config: Config = Config::new(config)?;
let producer = config.producer()?;
// Create the thread pool where the expensive computation will be performed.
let (dummy_tx, _) = bounded(1);
// TODO: does this need to be unbounded?
let (error_tx, error_rx) = bounded(crate::QSIZE);
Ok(SinkManager::new_box(Self {
sink_url: TremorUrl::from_offramp_id("kafka")?, // dummy
config,
producer,
postprocessors: vec![],
reply_tx: dummy_tx,
error_rx,
error_tx,
}))
} else {
Err("Kafka offramp requires a config".into())
}
}
}
/// Waits for actual delivery to kafka cluster and sends ack or fail.
/// Also sends fatal errors for handling in offramp task.
#[allow(clippy::cast_possible_truncation)]
async fn wait_for_delivery(
sink_url: String,
futures: Vec<rdkafka::producer::DeliveryFuture>,
processing_start: Instant,
maybe_event: Option<Event>,
reply_tx: Sender<sink::Reply>,
error_tx: Sender<RDKafkaError>,
) -> Result<()> {
let cb = match futures::future::try_join_all(futures).await {
Ok(results) => {
if let Some((KafkaError::Transaction(rd_error), _)) =
results.into_iter().find_map(std::result::Result::err)
{
error!(
"[Sink::{}] Error delivering kafka record: {}",
sink_url, &rd_error
);
if rd_error.is_fatal() {
let err_msg = format!("{}", &rd_error);
if error_tx.send(rd_error).await.is_err() {
error!(
"[Sink::{}] Error notifying the system about kafka error: {}",
&sink_url, &err_msg
);
}
}
CbAction::Fail
} else {
// all good. send ack
CbAction::Ack
}
}
Err(e) => {
error!(
"[Sink::{}] DeliveryFuture cancelled. Message delivery status unclear, considering it failed.: {}",
sink_url, e
);
// oh noes, send fail
CbAction::Fail
}
};
if let Some(mut insight) = maybe_event {
insight.cb = cb;
if cb == CbAction::Ack {
let time = processing_start.elapsed().as_millis() as u64;
let mut m = Object::with_capacity(1);
m.insert("time".into(), time.into());
insight.data = (Value::null(), m).into();
}
if reply_tx.send(sink::Reply::Insight(insight)).await.is_err() {
error!(
"[Sink::{}] Error sending {:?} insight after delivery",
sink_url, cb
);
}
}
Ok(())
}
impl Kafka {
fn drain_fatal_errors(&mut self) -> Result<()> {
let mut handled = false;
while let Ok(e) = self.error_rx.try_recv() {
if !handled {
// only handle on first fatal error
self.handle_fatal_error(&e)?;
handled = true;
}
}
Ok(())
}
fn handle_fatal_error(&mut self, fatal_error: &RDKafkaError) -> Result<()> {
error!(
"[Sink::{}] Fatal Error({:?}): {}",
&self.sink_url,
fatal_error.code(),
fatal_error.string()
);
error!("[Sink::{}] Reinitiating client...", &self.sink_url);
self.producer = self.config.producer()?;
error!("[Sink::{}] Client reinitiated.", &self.sink_url);
Ok(())
}
}
#[async_trait::async_trait]
impl Sink for Kafka {
async fn on_event(
&mut self,
_input: &str,
codec: &mut dyn Codec,
_codec_map: &HashMap<String, Box<dyn Codec>>,
mut event: Event,
) -> ResultVec {
// ensure we handle any fatal errors occured during last on_event invocation
self.drain_fatal_errors()?;
let ingest_ns = event.ingest_ns;
let mut delivery_futures = Vec::with_capacity(event.len()); // might not be enough
let processing_start = Instant::now();
for (value, meta) in event.value_meta_iter() {
let encoded = codec.encode(value)?;
let processed = postprocess(self.postprocessors.as_mut_slice(), ingest_ns, encoded)?;
let meta_kafka_data = meta.get_object("kafka");
let mut meta_kafka_key = None;
let mut meta_kafka_headers = None;
if let Some(meta_data) = meta_kafka_data {
meta_kafka_key = meta_data.get("key");
meta_kafka_headers = meta_data.get("headers");
}
for payload in processed {
// TODO: allow defining partition and timestamp in meta
let mut record = FutureRecord::to(self.config.topic.as_str());
record = record.payload(&payload);
if let Some(kafka_key) = meta_kafka_key {
if let Some(kafka_key_str) = kafka_key.as_str() {
record = record.key(kafka_key_str);
}
} else if let Some(kafka_key) = &self.config.key {
record = record.key(kafka_key.as_str());
}
if let Some(kafka_headers) = meta_kafka_headers {
if let Some(headers_obj) = kafka_headers.as_object() {
let mut headers = OwnedHeaders::new_with_capacity(headers_obj.len());
for (key, val) in headers_obj.iter() {
if let Some(val_str) = val.as_str() {
headers = headers.add(key, val_str);
}
}
record = record.headers(headers);
}
}
// send out without blocking on delivery
match self.producer.send_result(record) {
Ok(delivery_future) => {
delivery_futures.push(delivery_future);
}
Err((e, _)) => {
error!(
"[Sink::{}] failed to enqueue message: {}",
&self.sink_url, e
);
if let KafkaError::Transaction(e) = e {
if e.is_fatal() {
// handle fatal errors right here, without enqueueing
self.handle_fatal_error(&e)?;
}
}
// bail out with a CB fail on enqueue error
if event.transactional {
return Ok(Some(vec![sink::Reply::Insight(event.to_fail())]));
}
return Ok(None);
}
}
}
}
let insight_event = if event.transactional {
// we gonna change the success status later, if need be
Some(event.insight_ack())
} else {
None
};
// successfully enqueued all messages
// spawn the task waiting for delivery and send acks/fails then
task::spawn(wait_for_delivery(
self.sink_url.to_string(),
delivery_futures,
processing_start,
insight_event,
self.reply_tx.clone(),
self.error_tx.clone(),
));
Ok(None)
}
fn default_codec(&self) -> &str {
"json"
}
#[allow(clippy::too_many_arguments)]
async fn init(
&mut self,
_sink_uid: u64,
sink_url: &TremorUrl,
_codec: &dyn Codec,
_codec_map: &HashMap<String, Box<dyn Codec>>,
processors: Processors<'_>,
_is_linked: bool,
reply_channel: Sender<sink::Reply>,
) -> Result<()> {
self.postprocessors = make_postprocessors(processors.post)?;
self.reply_tx = reply_channel;
self.sink_url = sink_url.clone();
Ok(())
}
async fn on_signal(&mut self, _signal: Event) -> ResultVec {
self.drain_fatal_errors()?;
Ok(None)
}
fn is_active(&self) -> bool {
true
}
fn auto_ack(&self) -> bool {
false
}
async fn terminate(&mut self) {
if self.producer.in_flight_count() > 0 {
// wait a second in order to flush messages.
let wait_secs = 1;
info!(
"[Sink::{}] Flushing messages. Waiting for {} seconds.",
wait_secs, &self.sink_url
);
self.producer.flush(Duration::from_secs(1));
info!("[Sink::{}] Terminating.", &self.sink_url);
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.