pub struct FakeLookup { /* private fields */ }
Expand description
Instantiates a fake Lookup instance, which is useful for tests that don’t want to make a full end-to-end localization setup.
The fake is simplistic and it is the intention that it provides you with some default fake behaviors. The behaviors are as follows at the moment, and more could be added if needed.
- If
locale_ids
contains the stringen-US
, the constructor function in the FFI layer will return LookupStatus::Unavailable. - If the message ID pased to
Lookup::String()
is exactly 1, the fake returnsHello {person}!
, so that you can test 1-parameter formatting. - Otherwise, for an even mesage ID it returns “Hello world!”, or for an odd message ID returns LookupStatus::Unavailable.
The implementation of the fake itself is done in rust behind a FFI ABI, see the package //src/lib/intl/lookup/rust for details.
Implementations§
Source§impl FakeLookup
impl FakeLookup
Sourcepub fn new() -> FakeLookup
pub fn new() -> FakeLookup
Create a new FakeLookup
.
Auto Trait Implementations§
impl Freeze for FakeLookup
impl RefUnwindSafe for FakeLookup
impl Send for FakeLookup
impl Sync for FakeLookup
impl Unpin for FakeLookup
impl UnwindSafe for FakeLookup
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