mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-10-31 23:49:38 +00:00
Fixing macos and ios restrictions
This commit is contained in:
parent
5331bc8daf
commit
114fb55fc9
22
src/lib.rs
22
src/lib.rs
|
@ -107,8 +107,19 @@ impl fmt::Display for BackendId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
// # Note
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
//
|
||||||
|
// Most trait implementations are blocked by cocoa_foundation::base::id;
|
||||||
|
// which is a type alias for objc::runtime::Object, which only implements Debug.
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(
|
||||||
|
not(any(target_os = "macos", target_os = "ios")),
|
||||||
|
derive(Clone, Copy, Eq, Hash, PartialEq, PartialOrd, Ord)
|
||||||
|
)]
|
||||||
|
#[cfg_attr(
|
||||||
|
all(feature = "serde", not(any(target_os = "macos", target_os = "ios"))),
|
||||||
|
derive(serde::Serialize, serde::Deserialize)
|
||||||
|
)]
|
||||||
pub enum UtteranceId {
|
pub enum UtteranceId {
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
Android(u64),
|
Android(u64),
|
||||||
|
@ -122,13 +133,16 @@ pub enum UtteranceId {
|
||||||
WinRt(u64),
|
WinRt(u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// # Note
|
||||||
|
//
|
||||||
|
// Display is not implemented by cocoa_foundation::base::id;
|
||||||
|
// which is a type alias for objc::runtime::Object, which only implements Debug.
|
||||||
|
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
|
||||||
impl fmt::Display for UtteranceId {
|
impl fmt::Display for UtteranceId {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
match self {
|
match self {
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
UtteranceId::Android(id) => writeln!(f, "{}", id),
|
UtteranceId::Android(id) => writeln!(f, "{}", id),
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
|
||||||
UtteranceId::AvFoundation(id) => writeln!(f, "{}", id),
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
UtteranceId::SpeechDispatcher(id) => writeln!(f, "{}", id),
|
UtteranceId::SpeechDispatcher(id) => writeln!(f, "{}", id),
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user