diff options
author | Lucas Nogueira <118899497+lucasfernog-crabnebula@users.noreply.github.com> | 2024-10-17 13:39:18 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-17 12:39:18 -0400 |
commit | 3b62e05062805d45fd626ac8e413e9b7aee7c3a1 (patch) | |
tree | ff6b811b6c1781eee0d1bdb85da4d7dfa450b5ab /runtime/permissions/prompter.rs | |
parent | 33ceae4ce5c9f95bde52d5453a6c41488fa36846 (diff) |
feat(permissions): expose PermissionPrompter and set_prompter function (#26327)
when defining a custom runtime, it might be useful to define a custom
prompter - for instance when you are not relying on the terminal and
want a GUI prompter instead
Diffstat (limited to 'runtime/permissions/prompter.rs')
-rw-r--r-- | runtime/permissions/prompter.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/permissions/prompter.rs b/runtime/permissions/prompter.rs index 3d7536928..316911edc 100644 --- a/runtime/permissions/prompter.rs +++ b/runtime/permissions/prompter.rs @@ -80,6 +80,10 @@ pub fn set_prompt_callbacks( *MAYBE_AFTER_PROMPT_CALLBACK.lock() = Some(after_callback); } +pub fn set_prompter(prompter: Box<dyn PermissionPrompter>) { + *PERMISSION_PROMPTER.lock() = prompter; +} + pub type PromptCallback = Box<dyn FnMut() + Send + Sync>; pub trait PermissionPrompter: Send + Sync { @@ -476,8 +480,4 @@ pub mod tests { STUB_PROMPT_VALUE.store(value, Ordering::SeqCst); } } - - pub fn set_prompter(prompter: Box<dyn PermissionPrompter>) { - *PERMISSION_PROMPTER.lock() = prompter; - } } |