From 252174404e946ae70f672b521be85f62dc3e2ab5 Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Thu, 14 Mar 2024 16:46:00 +0900 Subject: [PATCH] =?UTF-8?q?`StyleIdToModelInnerId`=E3=82=92newtype?= =?UTF-8?q?=E5=8C=96=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core/Cargo.toml | 2 +- crates/voicevox_core/src/manifest.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/voicevox_core/Cargo.toml b/crates/voicevox_core/Cargo.toml index e2df292fa..e0f3372b0 100644 --- a/crates/voicevox_core/Cargo.toml +++ b/crates/voicevox_core/Cargo.toml @@ -32,7 +32,7 @@ open_jtalk.workspace = true ouroboros.workspace = true rayon.workspace = true regex.workspace = true -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true, features = ["derive", "rc"] } serde_json = { workspace = true, features = ["preserve_order"] } smallvec.workspace = true strum = { workspace = true, features = ["derive"] } diff --git a/crates/voicevox_core/src/manifest.rs b/crates/voicevox_core/src/manifest.rs index 9671d800b..a050e6f29 100644 --- a/crates/voicevox_core/src/manifest.rs +++ b/crates/voicevox_core/src/manifest.rs @@ -1,6 +1,7 @@ -use std::{collections::BTreeMap, fmt::Display}; +use std::{collections::BTreeMap, fmt::Display, sync::Arc}; use derive_getters::Getters; +use derive_more::Deref; use derive_new::new; use serde::{Deserialize, Serialize}; @@ -53,4 +54,6 @@ pub(crate) struct TalkManifest { pub(crate) style_id_to_model_inner_id: StyleIdToModelInnerId, } -pub(crate) type StyleIdToModelInnerId = BTreeMap; +#[derive(Default, Clone, Deref, Deserialize)] +#[deref(forward)] +pub(crate) struct StyleIdToModelInnerId(Arc>);