pub trait Terminal: Sync {
// Required methods
fn confirm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SigningRequest,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn explain(&self, msg: &str) -> Result<()>;
fn broadcast<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_line_raw<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_password<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn next_response<'life0, 'async_trait, D>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<D>> + Send + 'async_trait>>
where D: DomainType + 'async_trait,
Error: From<<D as TryFrom<<D as DomainType>::Proto>>::Error>,
<D as DomainType>::Proto: DeserializeOwned,
Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
A trait abstracting over the kind of terminal interface we expect.
This is mainly used to accommodate the kind of interaction we have with the CLI interface, but it can also be plugged in with more general backends.
Required Methods§
Sourcefn confirm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SigningRequest,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn confirm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SigningRequest,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Have a user confirm that they want to sign this transaction or other data (e.g. validator definition, validator vote)
In an actual terminal, this should display the data to be signed in a human readable form, and then get feedback from the user.
Sourcefn explain(&self, msg: &str) -> Result<()>
fn explain(&self, msg: &str) -> Result<()>
Push an explanatory message to the terminal.
This message has no relation to the actual protocol, it just allows explaining what subsequent data means, and what the user needs to do.
Backends can replace this with a no-op.
Sourcefn broadcast<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn broadcast<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Broadcast a message to other users.
Provided Methods§
Sourcefn next_response<'life0, 'async_trait, D>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<D>> + Send + 'async_trait>>where
D: DomainType + 'async_trait,
Error: From<<D as TryFrom<<D as DomainType>::Proto>>::Error>,
<D as DomainType>::Proto: DeserializeOwned,
Self: 'async_trait,
'life0: 'async_trait,
fn next_response<'life0, 'async_trait, D>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<D>> + Send + 'async_trait>>where
D: DomainType + 'async_trait,
Error: From<<D as TryFrom<<D as DomainType>::Proto>>::Error>,
<D as DomainType>::Proto: DeserializeOwned,
Self: 'async_trait,
'life0: 'async_trait,
Try to read a typed message from the terminal, retrying until the message parses successfully or the user interrupts the program.
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.