pub struct StaticLoader { /* private fields */ }
Expand description
A simple Loader implementation, with statically-loaded fluent data.
Typically created with the static_loader!
macro
Implementations§
Source§impl StaticLoader
impl StaticLoader
Sourcepub fn lookup_single_language<S: AsRef<str>>(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: Option<&HashMap<S, FluentValue<'_>>>,
) -> Result<String, LookupError>
pub fn lookup_single_language<S: AsRef<str>>( &self, lang: &LanguageIdentifier, text_id: &str, args: Option<&HashMap<S, FluentValue<'_>>>, ) -> Result<String, LookupError>
Convenience function to look up a string for a single language
Sourcepub fn lookup_no_default_fallback<S: AsRef<str>>(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: Option<&HashMap<S, FluentValue<'_>>>,
) -> Option<String>
pub fn lookup_no_default_fallback<S: AsRef<str>>( &self, lang: &LanguageIdentifier, text_id: &str, args: Option<&HashMap<S, FluentValue<'_>>>, ) -> Option<String>
Convenience function to look up a string without falling back to the default fallback language
Sourcepub fn fallback(&self) -> &LanguageIdentifier
pub fn fallback(&self) -> &LanguageIdentifier
Return the fallback language
Trait Implementations§
Source§impl Loader for StaticLoader
impl Loader for StaticLoader
Source§fn lookup_complete(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>,
) -> String
fn lookup_complete( &self, lang: &LanguageIdentifier, text_id: &str, args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>, ) -> String
Look up
text_id
for lang
in Fluent, using any args
if provided.Source§fn try_lookup_complete(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>,
) -> Option<String>
fn try_lookup_complete( &self, lang: &LanguageIdentifier, text_id: &str, args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>, ) -> Option<String>
Look up
text_id
for lang
in Fluent, using any args
if provided.Source§fn locales(&self) -> Box<dyn Iterator<Item = &LanguageIdentifier> + '_>
fn locales(&self) -> Box<dyn Iterator<Item = &LanguageIdentifier> + '_>
Returns an Iterator over the locales that are present.
Source§fn lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> String
fn lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> String
Look up
text_id
for lang
in Fluent.Source§fn lookup_with_args(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: &HashMap<Cow<'static, str>, FluentValue<'_>>,
) -> String
fn lookup_with_args( &self, lang: &LanguageIdentifier, text_id: &str, args: &HashMap<Cow<'static, str>, FluentValue<'_>>, ) -> String
Look up
text_id
for lang
with args
in Fluent.Source§fn try_lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> Option<String>
fn try_lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> Option<String>
Look up
text_id
for lang
in Fluent.Source§fn try_lookup_with_args(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: &HashMap<Cow<'static, str>, FluentValue<'_>>,
) -> Option<String>
fn try_lookup_with_args( &self, lang: &LanguageIdentifier, text_id: &str, args: &HashMap<Cow<'static, str>, FluentValue<'_>>, ) -> Option<String>
Look up
text_id
for lang
with args
in Fluent.Auto Trait Implementations§
impl Freeze for StaticLoader
impl !RefUnwindSafe for StaticLoader
impl Send for StaticLoader
impl Sync for StaticLoader
impl Unpin for StaticLoader
impl !UnwindSafe for StaticLoader
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