Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Sep 16, 2024
1 parent f32872e commit 58a42aa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions crates/voicevox_core_python_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ impl<T, C: PyTypeInfo> Drop for Closable<T, C> {
}

#[derive(Clone)]
struct VoiceModelFileImmutableFields {
id: PyObject,
metas: Py<PyList>,
struct VoiceModelFilePyFields {
id: PyObject, // `NewType("VoiceModelId", UUID)`
metas: Py<PyList>, // `list[SpeakerMeta]`
}

#[pyfunction]
Expand Down Expand Up @@ -185,13 +185,13 @@ mod blocking {
UserDictWord,
};

use crate::{convert::VoicevoxCoreResultExt as _, Closable, VoiceModelFileImmutableFields};
use crate::{convert::VoicevoxCoreResultExt as _, Closable, VoiceModelFilePyFields};

#[pyclass]
#[derive(Clone)]
pub(crate) struct VoiceModelFile {
model: Arc<std::sync::Mutex<Closable<Arc<voicevox_core::blocking::VoiceModelFile>, Self>>>,
immut_fields: VoiceModelFileImmutableFields,
immut_fields: VoiceModelFilePyFields,
}

#[pymethods]
Expand All @@ -207,7 +207,7 @@ mod blocking {

Ok(Self {
model,
immut_fields: VoiceModelFileImmutableFields { id, metas },
immut_fields: VoiceModelFilePyFields { id, metas },
})
}

Expand Down Expand Up @@ -725,14 +725,14 @@ mod asyncio {
UserDictWord,
};

use crate::{convert::VoicevoxCoreResultExt as _, Closable, VoiceModelFileImmutableFields};
use crate::{convert::VoicevoxCoreResultExt as _, Closable, VoiceModelFilePyFields};

#[pyclass]
#[derive(Clone)]
pub(crate) struct VoiceModelFile {
model:
Arc<std::sync::Mutex<Closable<Arc<voicevox_core::nonblocking::VoiceModelFile>, Self>>>,
immut_fields: VoiceModelFileImmutableFields,
immut_fields: VoiceModelFilePyFields,
}

#[pymethods]
Expand All @@ -753,7 +753,7 @@ mod asyncio {

Ok(Self {
model,
immut_fields: VoiceModelFileImmutableFields { id, metas },
immut_fields: VoiceModelFilePyFields { id, metas },
})
})
}
Expand Down

0 comments on commit 58a42aa

Please sign in to comment.