pub enum FluentError {
Overriding {
kind: EntryKind,
id: String,
},
ParserError(ParserError),
ResolverError(ResolverError),
}
Expand description
Core error type for Fluent runtime system.
It contains three main types of errors that may come up during runtime use of the fluent-bundle crate.
Variants
Overriding
An error which occurs when
FluentBundle::add_resource
adds entries that are already registered in a given FluentBundle
.
Example
use fluent_bundle::{FluentBundle, FluentResource};
use unic_langid::langid;
let ftl_string = String::from("intro = Welcome, { $name }.");
let res1 = FluentResource::try_new(ftl_string)
.expect("Could not parse an FTL string.");
let ftl_string = String::from("intro = Hi, { $name }.");
let res2 = FluentResource::try_new(ftl_string)
.expect("Could not parse an FTL string.");
let langid_en = langid!("en-US");
let mut bundle = FluentBundle::new(vec![langid_en]);
bundle.add_resource(&res1)
.expect("Failed to add FTL resources to the bundle.");
assert!(bundle.add_resource(&res2).is_err());
ParserError(ParserError)
ResolverError(ResolverError)
Auto Trait Implementations
impl RefUnwindSafe for FluentError
impl Send for FluentError
impl Sync for FluentError
impl Unpin for FluentError
impl UnwindSafe for FluentError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 80 bytes
Size for each variant:
Overriding
: 31 bytesParserError
: 79 bytesResolverError
: 63 bytes