Skip to main content

kothok_edge_tts/
lib.rs

1// SPDX-License-Identifier: MIT
2// Copyright (c) 2026 Nayeem Bin Ahsan
3#![doc = include_str!("../README.md")]
4
5mod auth;
6mod connection;
7mod edge_tts;
8mod error;
9mod event;
10mod protocol;
11mod rate;
12mod ssml;
13mod tts;
14mod voice_cache;
15mod voice_fetch;
16mod voice_table;
17mod voice_types;
18
19pub use edge_tts::EdgeTts;
20pub use error::TtsError;
21pub use event::TtsEvent;
22pub use tts::Engine;
23pub use voice_cache::{load_voice_cache, save_voice_cache};
24pub use voice_fetch::{list_voices, spawn_voice_fetch};
25pub use voice_table::{
26    normalize_lang, voice_label, voices_for_lang, DEFAULT_VOICE_BN, DEFAULT_VOICE_EN,
27};
28pub use voice_types::{set_dynamic_voices, VoiceEntry, VoiceInfo};
29
30pub use rate::{rate_percent, rate_string, RATE_BASELINE_OFFSET};
31
32/// Install rustls's `ring` crypto provider.
33///
34/// rustls 0.23 requires an explicit crypto provider before any TLS handshake.
35/// Call this **once** at startup, before the first [`EdgeTts`] connect.
36/// Idempotent - safe to call multiple times.
37pub fn init_tls() {
38    // best-effort: idempotent - the provider may already be installed by the host
39    let _ = rustls::crypto::ring::default_provider().install_default();
40}