mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-17 11:29:37 +00:00
Add Arc<RwLock<...>>
for remaining platforms.
This commit is contained in:
parent
31309553bb
commit
5944794980
14
src/lib.rs
14
src/lib.rs
|
@ -282,13 +282,13 @@ impl Tts {
|
|||
#[cfg(target_arch = "wasm32")]
|
||||
Backends::Web => {
|
||||
let tts = backends::Web::new()?;
|
||||
Ok(Tts(Box::new(tts)))
|
||||
Ok(Tts(Arc::new(RwLock::new(Box::new(tts)))))
|
||||
}
|
||||
#[cfg(all(windows, feature = "tolk"))]
|
||||
Backends::Tolk => {
|
||||
let tts = backends::Tolk::new();
|
||||
if let Some(tts) = tts {
|
||||
Ok(Tts(Box::new(tts)))
|
||||
Ok(Tts(Arc::new(RwLock::new(Box::new(tts)))))
|
||||
} else {
|
||||
Err(Error::NoneError)
|
||||
}
|
||||
|
@ -299,13 +299,17 @@ impl Tts {
|
|||
Ok(Tts(Arc::new(RwLock::new(Box::new(tts)))))
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
Backends::AppKit => Ok(Tts(Box::new(backends::AppKit::new()))),
|
||||
Backends::AppKit => Ok(Tts(Arc::new(RwLock::new(
|
||||
Box::new(backends::AppKit::new()),
|
||||
)))),
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
Backends::AvFoundation => Ok(Tts(Box::new(backends::AvFoundation::new()))),
|
||||
Backends::AvFoundation => Ok(Tts(Arc::new(RwLock::new(Box::new(
|
||||
backends::AvFoundation::new(),
|
||||
))))),
|
||||
#[cfg(target_os = "android")]
|
||||
Backends::Android => {
|
||||
let tts = backends::Android::new()?;
|
||||
Ok(Tts(Box::new(tts)))
|
||||
Ok(Tts(Arc::new(RwLock::new(Box::new(tts)))))
|
||||
}
|
||||
};
|
||||
if let Ok(backend) = backend {
|
||||
|
|
Loading…
Reference in New Issue
Block a user