pub struct FluentDocument { /* private fields */ }Expand description
A normalized, representation of all Fluent translations for one locale.
FluentDocument aggregates entries from one or more ParsedFluentFiles belonging
to the same locale (e.g. split files like en-GB/auth.ftl, en-GB/ui.ftl, en-GB/errors.ftl all for en-GB).
Implementations§
Source§impl FluentDocument
impl FluentDocument
Sourcepub fn from_parsed_files(locale: &Locale, files: &[ParsedFluentFile]) -> Self
pub fn from_parsed_files(locale: &Locale, files: &[ParsedFluentFile]) -> Self
Constructs a FluentDocument by merging entries from all ParsedFluentFiles
that match the given locale.
Sourcepub fn entry_identifiers(&self) -> impl Iterator<Item = QualifiedIdentifier>
pub fn entry_identifiers(&self) -> impl Iterator<Item = QualifiedIdentifier>
Returns an iterator over all top-level qualified identifiers defined in this document.
Sourcepub fn all_identifiers(&self) -> impl Iterator<Item = QualifiedIdentifier>
pub fn all_identifiers(&self) -> impl Iterator<Item = QualifiedIdentifier>
Returns an iterator over all identifiers used or defined (including placeholders and references inside patterns).
Sourcepub fn duplicate_identifier_names(
&self,
) -> impl Iterator<Item = QualifiedIdentifier>
pub fn duplicate_identifier_names( &self, ) -> impl Iterator<Item = QualifiedIdentifier>
Returns an iterator over identifiers that appear more than once in the document.
Sourcepub fn invalid_references(&self) -> impl Iterator<Item = QualifiedIdentifier>
pub fn invalid_references(&self) -> impl Iterator<Item = QualifiedIdentifier>
Returns an iterator over identifiers that are referenced, e.g. { $var },
but not defined elsewhere in the document.
Sourcepub fn signature(&self, identifier: &QualifiedIdentifier) -> Option<&Signature>
pub fn signature(&self, identifier: &QualifiedIdentifier) -> Option<&Signature>
Returns the placeholder signature (arguments/variables) for the given identifier, if it is defined in this document.
Sourcepub fn entries(
&self,
identifier: &QualifiedIdentifier,
) -> impl Iterator<Item = &Entry>
pub fn entries( &self, identifier: &QualifiedIdentifier, ) -> impl Iterator<Item = &Entry>
Returns an iterator over all AST Entry nodes that define the given identifier.
Trait Implementations§
Source§impl Clone for FluentDocument
impl Clone for FluentDocument
Source§fn clone(&self) -> FluentDocument
fn clone(&self) -> FluentDocument
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FluentDocument
impl Debug for FluentDocument
Source§impl Default for FluentDocument
impl Default for FluentDocument
Source§fn default() -> FluentDocument
fn default() -> FluentDocument
Source§impl PartialEq for FluentDocument
impl PartialEq for FluentDocument
impl Eq for FluentDocument
impl StructuralPartialEq for FluentDocument
Auto Trait Implementations§
impl !Freeze for FluentDocument
impl !RefUnwindSafe for FluentDocument
impl !Send for FluentDocument
impl !Sync for FluentDocument
impl Unpin for FluentDocument
impl UnsafeUnpin for FluentDocument
impl UnwindSafe for FluentDocument
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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.