Skip to content

Commit

Permalink
docs: [Rust] Firefox以外でスペースが入りまくっているのを直す (#982)
Browse files Browse the repository at this point in the history
影響範囲はrustdocのみのため、rustdocでレンダリングされる範囲に絞ってい
る。
  • Loading branch information
qryxip authored Feb 7, 2025
1 parent 55f24dd commit 85f6d62
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 38 deletions.
8 changes: 2 additions & 6 deletions crates/voicevox_core/src/asyncs.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
//! 非同期操作の実装の切り替えを行う。
//!
//! 「[ブロッキング版API]」と「[非同期版API]」との違いはここに集約される
//! …予定。現在は[`crate::voice_model`]のみで利用している。
//! 「[ブロッキング版API]」と「[非同期版API]」との違いはここに集約される…予定。現在は[`crate::voice_model`]のみで利用している。
//!
//! # Motivation
//!
//! [blocking]クレートで駆動する非同期処理はランタイムが無くても動作する。そのため非同期版APIを
//! もとにブロッキング版APIを構成することはできる。しかし将来WASMビルドすることを考えると、スレッド
//! がまともに扱えないため機能しなくなってしまう。そのためWASM化を見越したブロッキング版APIのため
//! に[`SingleTasked`]を用意している。
//! [blocking]クレートで駆動する非同期処理はランタイムが無くても動作する。そのため非同期版APIをもとにブロッキング版APIを構成することはできる。しかし将来WASMビルドすることを考えると、スレッドがまともに扱えないため機能しなくなってしまう。そのためWASM化を見越したブロッキング版APIのために[`SingleTasked`]を用意している。
//!
//! [ブロッキング版API]: crate::blocking
//! [非同期版API]: crate::nonblocking
Expand Down
9 changes: 3 additions & 6 deletions crates/voicevox_core/src/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ fn test_gpu(

/// 利用可能なデバイスの情報。
///
/// あくまで本ライブラリもしくはONNX Runtimeが対応しているデバイスの情報であることに注意。GPUが使える環境ではなかったと
/// しても`cuda`や`dml`は`true`を示しうる。
/// あくまで本ライブラリもしくはONNX Runtimeが対応しているデバイスの情報であることに注意。GPUが使える環境ではなかったとしても`cuda`や`dml`は`true`を示しうる。
///
/// ```
/// # #[pollster::main]
Expand All @@ -77,15 +76,13 @@ pub struct SupportedDevices {
pub cpu: bool,
/// CUDAが利用可能。
///
/// ONNX Runtimeの[CUDA Execution Provider] (`CUDAExecutionProvider`)に対応する。必要な環境につ
/// いてはそちらを参照。
/// ONNX Runtimeの[CUDA Execution Provider] (`CUDAExecutionProvider`)に対応する。必要な環境についてはそちらを参照。
///
/// [CUDA Execution Provider]: https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html
pub cuda: bool,
/// DirectMLが利用可能。
///
/// ONNX Runtimeの[DirectML Execution Provider] (`DmlExecutionProvider`)に対応する。必要な環境に
/// ついてはそちらを参照。
/// ONNX Runtimeの[DirectML Execution Provider] (`DmlExecutionProvider`)に対応する。必要な環境についてはそちらを参照。
///
/// [DirectML Execution Provider]: https://onnxruntime.ai/docs/execution-providers/DirectML-ExecutionProvider.html
pub dml: bool,
Expand Down
13 changes: 4 additions & 9 deletions crates/voicevox_core/src/infer/runtimes/onnxruntime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ pub(crate) mod blocking {
///
/// # Rust APIにおけるインスタンスの共有
///
/// インスタンスは[voicevox-ort]側に作られる。Rustのクレートとしてこのライブラリを利用する場合、
/// 非同期版APIやvoicevox-ortを利用する他クレートともインスタンスが共有される。
/// インスタンスは[voicevox-ort]側に作られる。Rustのクレートとしてこのライブラリを利用する場合、非同期版APIやvoicevox-ortを利用する他クレートともインスタンスが共有される。
///
#[cfg_attr(feature = "load-onnxruntime", doc = "```")]
#[cfg_attr(not(feature = "load-onnxruntime"), doc = "```compile_fail")]
Expand Down Expand Up @@ -448,8 +447,7 @@ pub(crate) mod blocking {
impl LoadOnce {
/// ONNX Runtimeのファイル名(モジュール名)もしくはファイルパスを指定する。
///
/// `dlopen`/[`LoadLibraryExW`]の引数に使われる。デフォルト
/// は[`Onnxruntime::LIB_VERSIONED_FILENAME`]。
/// `dlopen`/[`LoadLibraryExW`]の引数に使われる。デフォルトは[`Onnxruntime::LIB_VERSIONED_FILENAME`]。
///
/// [`LoadLibraryExW`]:
/// https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw
Expand All @@ -476,9 +474,7 @@ pub(crate) mod nonblocking {
///
/// # Rust APIにおけるインスタンスの共有
///
/// インスタンスは[voicevox-ort]側に作られる。Rustのクレートとしてこのライブラリを利用する場合、
/// ブロッキング版APIやvoicevox-ortを利用する他クレートともインスタンスが共有される。
///
/// インスタンスは[voicevox-ort]側に作られる。Rustのクレートとしてこのライブラリを利用する場合、ブロッキング版APIやvoicevox-ortを利用する他クレートともインスタンスが共有される。
#[cfg_attr(feature = "load-onnxruntime", doc = "```")]
#[cfg_attr(not(feature = "load-onnxruntime"), doc = "```compile_fail")]
/// # use voicevox_core as another_lib;
Expand Down Expand Up @@ -598,8 +594,7 @@ pub(crate) mod nonblocking {
impl LoadOnce {
/// ONNX Runtimeのファイル名(モジュール名)もしくはファイルパスを指定する。
///
/// `dlopen`/[`LoadLibraryExW`]の引数に使われる。デフォルト
/// は[`Onnxruntime::LIB_VERSIONED_FILENAME`]。
/// `dlopen`/[`LoadLibraryExW`]の引数に使われる。デフォルトは[`Onnxruntime::LIB_VERSIONED_FILENAME`]。
///
/// [`LoadLibraryExW`]:
/// https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw
Expand Down
14 changes: 4 additions & 10 deletions crates/voicevox_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
//!
//! # Feature flags
//!
//! このクレートの利用にあたっては以下の二つの[Cargoフィーチャ]のうちどちらかを有効にしなければなり
//! ません。両方の有効化はコンパイルエラーとなります。[`Onnxruntime`]の初期化方法はこれらの
//! フィーチャによって決まります。
//! このクレートの利用にあたっては以下の二つの[Cargoフィーチャ]のうちどちらかを有効にしなければなりません。両方の有効化はコンパイルエラーとなります。[`Onnxruntime`]の初期化方法はこれらのフィーチャによって決まります。
//!
//! - **`load-onnxruntime`**: ONNX Runtimeを`dlopen`/`LoadLibraryExW`で
//! 開きます。[CUDA]と[DirectML]が利用できます。
//! - **`link-onnxruntime`**: ONNX Runtimeをロード時動的リンクします。iOSのような`dlopen`の利用が
//! 困難な環境でのみこちらを利用するべきです。_Note_:
//! [動的リンク対象のライブラリ名]は`onnxruntime`で固定です。変更
//! は`patchelf(1)`や`install_name_tool(1)`で行ってください。また、[ONNX RuntimeのGPU機能]を使う
//! ことはできません。
//! - **`load-onnxruntime`**: ONNX Runtimeを`dlopen`/`LoadLibraryExW`で開きます。[CUDA]と[DirectML]が利用できます。
//! - **`link-onnxruntime`**: ONNX Runtimeをロード時動的リンクします。iOSのような`dlopen`の利用が困難な環境でのみこちらを利用するべきです。_Note_:
//! [動的リンク対象のライブラリ名]は`onnxruntime`で固定です。変更は`patchelf(1)`や`install_name_tool(1)`で行ってください。また、[ONNX RuntimeのGPU機能]を使うことはできません。
//!
//! [Cargoフィーチャ]: https://doc.rust-lang.org/stable/cargo/reference/features.html
//! [CUDA]: https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html
Expand Down
7 changes: 2 additions & 5 deletions crates/voicevox_core/src/nonblocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
//!
//! # Performance
//!
//! これらは[blocking]クレートにより動いている。特定の非同期ランタイムを必要とせず、[pollster]など
//! でも動かすことができる。
//! これらは[blocking]クレートにより動いている。特定の非同期ランタイムを必要とせず、[pollster]などでも動かすことができる。
//!
//! スレッドプールおよびエグゼキュータはblockingクレートに依存するすべてのプログラム間で共有される。
//! スレッドプールのサイズは、blockingクレートの説明にある通り`$BLOCKING_MAX_THREADS`で調整すること
//! ができる。
//! スレッドプールおよびエグゼキュータはblockingクレートに依存するすべてのプログラム間で共有される。スレッドプールのサイズは、blockingクレートの説明にある通り`$BLOCKING_MAX_THREADS`で調整することができる。
//!
//! また未調査ではあるが、このモジュールについては[`cpu_num_threads`]は物理コアの数+1を指定するのが適切な可能性がある
//! ([VOICEVOX/voicevox_core#902])。
Expand Down
5 changes: 3 additions & 2 deletions crates/voicevox_core/src/version.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/// 本クレートの`package.version`。
///
/// C APIやPython API側からこの値が使われるべきではない。
/// 現在はまだRust APIを外部提供していないため、この定数はどこからも参照されていないはずである。
/// TODO: ↓ 「Rust APIを外部提供」はもう嘘
///
/// C APIやPython API側からこの値が使われるべきではない。現在はまだRust APIを外部提供していないため、この定数はどこからも参照されていないはずである。
#[doc(alias = "voicevox_get_version")]
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

Expand Down

0 comments on commit 85f6d62

Please sign in to comment.