pub struct ProfileStore { /* private fields */ }target_family=wasm only.Expand description
The directory of enrolled voices.
Implementations§
Source§impl ProfileStore
impl ProfileStore
pub fn open(directory: impl Into<PathBuf>) -> Self
Sourcepub fn read_all(&self) -> Result<StoredProfiles, ProfileError>
pub fn read_all(&self) -> Result<StoredProfiles, ProfileError>
Every profile in the directory. One unreadable file does not hide the
others; it comes back in StoredProfiles::unreadable. A directory
that does not exist means nobody has enrolled, which is ordinary.
Sourcepub fn read_for(
&self,
engine: &str,
dimension: usize,
) -> Result<StoredProfiles, ProfileError>
pub fn read_for( &self, engine: &str, dimension: usize, ) -> Result<StoredProfiles, ProfileError>
The profiles engine measured, at the width it produces. Everything
else was made by a different model and cannot be compared.
Sourcepub fn save(
&self,
profile: &Profile,
replace: Replace,
) -> Result<(), ProfileError>
pub fn save( &self, profile: &Profile, replace: Replace, ) -> Result<(), ProfileError>
Stores a profile. Replace::Never refuses when a profile is already
there, judged by the filesystem rather than by comparing names: a name
that folds onto an existing one would otherwise overwrite it.
ProfileError::DurabilityUnconfirmed means the profile is stored
and live; only whether it survives a power cut is unknown.
Sourcepub fn remove(&self, name: &SpeakerName) -> Result<bool, ProfileError>
pub fn remove(&self, name: &SpeakerName) -> Result<bool, ProfileError>
false when nobody by that name was enrolled.
Sourcepub fn contains(&self, name: &SpeakerName) -> bool
pub fn contains(&self, name: &SpeakerName) -> bool
Whether name addresses a stored profile. A filesystem that ignores
case finds ada.json for “Ada”.