pub trait Callbacks:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn display_message(&self, message: &str);
fn confirm(
&self,
message: &str,
yes_string: &str,
no_string: Option<&str>,
) -> Option<bool>;
fn request_public_string(&self, description: &str) -> Option<String>;
fn request_passphrase(&self, description: &str) -> Option<SecretBox<str>>;
}Expand description
Callbacks that might be triggered during encryption or decryption.
Structs that implement this trait should be given directly to the individual
Recipient or Identity implementations that require them.
Required Methods§
Sourcefn display_message(&self, message: &str)
fn display_message(&self, message: &str)
Shows a message to the user.
This can be used to prompt the user to take some physical action, such as inserting a hardware key.
No guarantee is provided that the user sees this message (for example, if there is no UI for displaying messages).
Sourcefn confirm(
&self,
message: &str,
yes_string: &str,
no_string: Option<&str>,
) -> Option<bool>
fn confirm( &self, message: &str, yes_string: &str, no_string: Option<&str>, ) -> Option<bool>
Requests that the user provides confirmation for some action.
This can be used to, for example, request that a hardware key the plugin wants to try either be plugged in, or skipped.
messageis the request or call-to-action to be displayed to the user.yes_stringand (optionally)no_stringwill be displayed on buttons or next to selection options in the user’s UI.
Returns:
Some(true)if the user selected the option marked withyes_string.Some(false)if the user selected the option marked withno_string(or the default negative confirmation label).Noneif the confirmation request could not be given to the user (for example, if there is no UI for displaying messages).
Sourcefn request_public_string(&self, description: &str) -> Option<String>
fn request_public_string(&self, description: &str) -> Option<String>
Requests non-private input from the user.
To request private inputs, use Callbacks::request_passphrase.
Returns:
Some(input)with the user-provided input.Noneif no input could be requested from the user (for example, if there is no UI for displaying messages or typing inputs).
Sourcefn request_passphrase(&self, description: &str) -> Option<SecretBox<str>>
fn request_passphrase(&self, description: &str) -> Option<SecretBox<str>>
Requests a passphrase to decrypt a key.
Returns:
Some(passphrase)with the user-provided passphrase.Noneif no passphrase could be requested from the user (for example, if there is no UI for displaying messages or typing inputs).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.