pub struct FluentTemplate {
pub notes: Vec<FluentNote>,
pub entries: Vec<FluentEntry>,
}
Expand description
Represents all calls to l10n!
or similar macro scraped from selected Rust code files.
Use scrape_fluent_text
to collect entries.
Fields§
§notes: Vec<FluentNote>
Scraped standalone note comments.
entries: Vec<FluentEntry>
Scraped entries.
Not sorted, keys not validated.
Implementations§
source§impl FluentTemplate
impl FluentTemplate
sourcepub fn sort(&mut self)
pub fn sort(&mut self)
Sort by file, section, id and attribute. Attributes on different sections are moved to the id or first attribute section, repeated id and entries are merged.
sourcepub fn write(
&self,
write_file: impl Fn(&str, &str) -> Result<()> + Send + Sync,
) -> Result<()>
pub fn write( &self, write_file: impl Fn(&str, &str) -> Result<()> + Send + Sync, ) -> Result<()>
Write all entries to new FLT files.
Template must be sorted before this call.
Entries are separated by file and grouped by section, the notes are copied at the beginning of each file, the section, id and attribute lists are sorted.
The write_file
closure is called once for each different file, it must write (or check) the file.
Trait Implementations§
source§impl Default for FluentTemplate
impl Default for FluentTemplate
source§fn default() -> FluentTemplate
fn default() -> FluentTemplate
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FluentTemplate
impl RefUnwindSafe for FluentTemplate
impl Send for FluentTemplate
impl Sync for FluentTemplate
impl Unpin for FluentTemplate
impl UnwindSafe for FluentTemplate
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more