pub struct GettextStoreManager { /* private fields */ }Expand description
Manager owning the FileStore and a path-keyed cache of stores.
Implementations§
Source§impl GettextStoreManager
impl GettextStoreManager
Sourcepub fn new(default_path: Option<PathBuf>) -> Self
pub fn new(default_path: Option<PathBuf>) -> Self
Construct a manager using crate::io::FsFileStore as the
backing store. Same signature the rest of the crate (tests, web,
CLI) has historically used.
Sourcepub fn with_file_store(
default_path: Option<PathBuf>,
file_store: Arc<dyn FileStore>,
) -> Self
pub fn with_file_store( default_path: Option<PathBuf>, file_store: Arc<dyn FileStore>, ) -> Self
Construct a manager with a caller-supplied FileStore.
Sourcepub async fn scan_directory(&self) -> Result<usize, GettextError>
pub async fn scan_directory(&self) -> Result<usize, GettextError>
Recursively scan the default path (if it is a directory) for
.po/.pot files, pre-load them, and return the count.
Sourcepub async fn store_for(
&self,
path: Option<&str>,
) -> Result<Arc<GettextStore>, GettextError>
pub async fn store_for( &self, path: Option<&str>, ) -> Result<Arc<GettextStore>, GettextError>
Look up (or create) a store for the caller-supplied path. When
path is None the default path is used (in single-file mode).
Sourcepub async fn discovered_paths(&self) -> Vec<PathBuf>
pub async fn discovered_paths(&self) -> Vec<PathBuf>
Paths of every store currently loaded (including those preloaded
by [scan_directory]).
Sourcepub fn is_directory_mode(&self) -> bool
pub fn is_directory_mode(&self) -> bool
Whether the configured default path is a directory (vs. a single
file or None).
Sourcepub fn file_store(&self) -> &Arc<dyn FileStore>
pub fn file_store(&self) -> &Arc<dyn FileStore>
Shared reference to the backing FileStore. Used by tools that
read or write auxiliary files (e.g. XLIFF documents) so they go
through the same I/O layer (atomic writes, advisory locking, BOM
stripping) as the PO files themselves.