pub struct Workspace { /* private fields */ }Expand description
The complete set of files and configuration used as input to an audit.
A Workspace gathers:
- All discovered Fluent translation files (
.ftl) - The designated canonical (reference) locale
- Explicitly configured primary locales
- Rust source files to scan for
dioxus_i18n
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn new(
fluent_files: Vec<FluentFile>,
canonical: Locale,
primaries: Vec<Locale>,
rust_files: Vec<RustFile>,
) -> Self
pub fn new( fluent_files: Vec<FluentFile>, canonical: Locale, primaries: Vec<Locale>, rust_files: Vec<RustFile>, ) -> Self
Creates a new Workspace from its constituent parts.
Sourcepub fn fluent_files(&self) -> &[FluentFile]
pub fn fluent_files(&self) -> &[FluentFile]
Returns a slice of all Fluent files in the workspace.
Sourcepub fn locales(&self) -> impl Iterator<Item = &Locale>
pub fn locales(&self) -> impl Iterator<Item = &Locale>
Returns an iterator over all unique locales found in the Fluent files.
Sourcepub fn language_roots(&self) -> impl Iterator<Item = LanguageRoot>
pub fn language_roots(&self) -> impl Iterator<Item = LanguageRoot>
Returns an iterator over all unique language roots present in the workspace.
Sourcepub fn locales_by_language_root(
&self,
root: &LanguageRoot,
) -> impl Iterator<Item = &Locale>
pub fn locales_by_language_root( &self, root: &LanguageRoot, ) -> impl Iterator<Item = &Locale>
Returns an iterator over all locales that belong to the given language root.
Sourcepub fn fluent_files_by_locale(
&self,
locale: &Locale,
) -> impl Iterator<Item = &FluentFile>
pub fn fluent_files_by_locale( &self, locale: &Locale, ) -> impl Iterator<Item = &FluentFile>
Returns an iterator over all Fluent files for the exact given locale, sorted by file path (stable order).
Sourcepub fn canonical_locale(&self) -> &Locale
pub fn canonical_locale(&self) -> &Locale
Returns the configured canonical (reference) locale.
Sourcepub fn is_canonical_locale(&self, locale: &Locale) -> bool
pub fn is_canonical_locale(&self, locale: &Locale) -> bool
Returns true if the given locale is the canonical one.
Sourcepub fn primary_locales(&self) -> impl Iterator<Item = &Locale>
pub fn primary_locales(&self) -> impl Iterator<Item = &Locale>
Returns an iterator over all explicitly configured primary locales.
Sourcepub fn is_primary_locale(&self, locale: &Locale) -> bool
pub fn is_primary_locale(&self, locale: &Locale) -> bool
Returns true if the given locale is one of the configured primaries.
Sourcepub fn base_locales(&self) -> impl Iterator<Item = &Locale>
pub fn base_locales(&self) -> impl Iterator<Item = &Locale>
Returns an iterator over all base locales — i.e. canonical + primaries.
Sourcepub fn is_base_locale(&self, locale: &Locale) -> bool
pub fn is_base_locale(&self, locale: &Locale) -> bool
Returns true if the given locale is a base locale (canonical or primary).
Sourcepub fn variant_locales(&self, base: &Locale) -> impl Iterator<Item = &Locale>
pub fn variant_locales(&self, base: &Locale) -> impl Iterator<Item = &Locale>
Returns an iterator over all variant locales for the given base locale.
Sourcepub fn orphan_locales(&self) -> impl Iterator<Item = &Locale>
pub fn orphan_locales(&self) -> impl Iterator<Item = &Locale>
Returns an iterator over all orphan locales.
Sourcepub fn is_orphan_locale(&self, locale: &Locale) -> bool
pub fn is_orphan_locale(&self, locale: &Locale) -> bool
Returns true if the given locale is an orphan (no matching base root).
Sourcepub fn rust_files(&self) -> &[RustFile]
pub fn rust_files(&self) -> &[RustFile]
Returns a slice of all Rust files included in the workspace.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Workspace
impl RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnsafeUnpin for Workspace
impl UnwindSafe for Workspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.