Move interaction constructors back to individual types
Dependencies
- [2]
IZ67IMRIMove prompt message to initial constructor - [3]
BAH2JCJPAdd progress bar to `fluent_embed_interaction` - [4]
IXBE5Q6TImplement `InteractionEnvironment::print_message` - [5]
KFFAQIZURename `InteractionEnvironment::print_message` to `emit_message` - [6]
EKXWNEPKRename `Localize::message_for_locale` to `Localize::localize_for` - [7]
NEBSVXIAApply Clippy fixes - [8]
JUV7C6ETCreate initial prototype of `fluent_embed_interaction` - [9]
7YOM2QEFMove interaction constructors from individual types to implementations on `InteractionEnvironment`
Change contents
- replacement in l10n_embed_interaction/src/prompt/select.rs at line 15
pub(crate) fn new_from_environment<L: Localize>(environment: &'environment InteractionEnvironment,prompt: L,) -> Self {pub fn new<L: Localize>(environment: &'environment InteractionEnvironment, prompt: L) -> Self { - replacement in l10n_embed_interaction/src/prompt/password.rs at line 20
pub(crate) fn new_from_environment<L: Localize>(pub fn new<L: Localize>( - replacement in l10n_embed_interaction/src/prompt/input.rs at line 15
pub(crate) fn new_from_environment<L: Localize>(pub fn new<L: Localize>( - replacement in l10n_embed_interaction/src/prompt/confirm.rs at line 15
pub(crate) fn new_from_environment<L: Localize>(environment: &'environment InteractionEnvironment,prompt: L,) -> Self {pub fn new<L: Localize>(environment: &'environment InteractionEnvironment, prompt: L) -> Self { - replacement in l10n_embed_interaction/src/progress.rs at line 18
pub(crate) fn new_from_environment<L: Localize>(pub fn new<L: Localize>( - edit in l10n_embed_interaction/src/lib.rs at line 55[3.602]→[3.3796:3949](∅→∅),[3.3796]→[3.3796:3949](∅→∅),[3.3949]→[2.2296:2530](∅→∅),[2.2530]→[3.4104:4138](∅→∅),[3.4104]→[3.4104:4138](∅→∅),[3.4138]→[2.2531:2607](∅→∅),[2.2607]→[3.4219:4260](∅→∅),[3.4219]→[3.4219:4260](∅→∅),[3.4299]→[3.4299:4418](∅→∅),[3.4418]→[2.2608:2864](∅→∅)
}}macro_rules! impl_constructor {($prompt_name:ident, $prompt_type:ident) => {impl InteractionEnvironment {#[must_use]pub fn $prompt_name<'environment, L: Localize>(&'environment self,prompt: L,) -> $prompt_type<'environment> {$prompt_type::new_from_environment(self, prompt)}}};}// Create constructors on InteractionEnvironment for different prompt typesimpl_constructor!(new_confirm, Confirm);impl_constructor!(new_input, Input);impl_constructor!(new_password, Password);impl_constructor!(new_select, Select);// Special implementation for text editor as the signature is differentimpl InteractionEnvironment {pub fn new_editor<'environment>(&'environment self, extension: &str) -> Editor<'environment> {Editor::new_from_environment(self, extension) - edit in l10n_embed_interaction/src/lib.rs at line 57[2.2872]→[3.4418:4732](∅→∅),[3.4418]→[3.4418:4732](∅→∅),[3.151]→[3.10328:10336](∅→∅),[3.4732]→[3.10328:10336](∅→∅),[3.10328]→[3.10328:10336](∅→∅)
// Special implementation for progress bars as the signature is differentimpl InteractionEnvironment {pub fn new_progress<'environment, L: Localize>(&'environment self,message: L,length: u64,) -> ProgressBar {ProgressBar::new_from_environment(self, message, length)}} - replacement in l10n_embed_interaction/src/editor.rs at line 10
pub(crate) fn new_from_environment(environment: &'environment InteractionEnvironment,extension: &str,) -> Self {pub fn new(environment: &'environment InteractionEnvironment, extension: &str) -> Self {