Upgrade windows-rs to 0.23.

pull/16/head
Nolan Darilek 11 months ago
parent dc3129b79c
commit 92538fbdb8
  1. 14
      Cargo.toml
  2. 10
      build.rs
  3. 9
      src/backends/winrt.rs
  4. 1
      src/backends/winrt/bindings.rs
  5. 2
      src/lib.rs

@ -20,12 +20,18 @@ thiserror = "1"
[dev-dependencies]
env_logger = "0.8"
[dependencies.windows]
version = "0.23"
features = [
"Foundation",
"Media_Core",
"Media_Playback",
"Media_SpeechSynthesis",
"Storage_Streams",
]
[target.'cfg(windows)'.dependencies]
tolk = { version = "0.5", optional = true }
windows = "0.9"
[target.'cfg(windows)'.build-dependencies]
windows = "0.9"
[target.'cfg(target_os = "linux")'.dependencies]
speech-dispatcher = "0.7"

@ -1,14 +1,4 @@
fn main() {
#[cfg(windows)]
if std::env::var("TARGET").unwrap().contains("windows") {
windows::build!(
Windows::Foundation::{EventRegistrationToken, IAsyncOperation, TypedEventHandler},
Windows::Media::Core::MediaSource,
Windows::Media::Playback::{MediaPlaybackSession, MediaPlaybackState, MediaPlayer, MediaPlayerAudioCategory},
Windows::Media::SpeechSynthesis::{SpeechSynthesisStream, SpeechSynthesizer, SpeechSynthesizerOptions},
Windows::Storage::Streams::IRandomAccessStream,
);
}
if std::env::var("TARGET").unwrap().contains("-apple") {
println!("cargo:rustc-link-lib=framework=AVFoundation");
if !std::env::var("CARGO_CFG_TARGET_OS")

@ -4,10 +4,7 @@ use std::sync::Mutex;
use lazy_static::lazy_static;
use log::{info, trace};
mod bindings;
use bindings::Windows::{
use windows::{
Foundation::TypedEventHandler,
Media::{
Core::MediaSource,
@ -18,8 +15,8 @@ use bindings::Windows::{
use crate::{Backend, BackendId, Error, Features, UtteranceId, CALLBACKS};
impl From<windows::Error> for Error {
fn from(e: windows::Error) -> Self {
impl From<windows::runtime::Error> for Error {
fn from(e: windows::runtime::Error) -> Self {
Error::WinRt(e)
}
}

@ -1 +0,0 @@
::windows::include_bindings!();

@ -117,7 +117,7 @@ pub enum Error {
JavaScriptError(wasm_bindgen::JsValue),
#[cfg(windows)]
#[error("WinRT error")]
WinRt(windows::Error),
WinRt(windows::runtime::Error),
#[error("Unsupported feature")]
UnsupportedFeature,
#[error("Out of range")]

Loading…
Cancel
Save