-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
use indicatif::WeakProgressBar; | ||
|
||
/// A persistent message that is only usable for humans, for example a spinner. | ||
pub trait Widget { | ||
/// Allows for live interaction with the widget, and its drop is called when the widget should | ||
/// be cleared. | ||
type Handle; | ||
type Handle: WidgetHandle; | ||
|
||
/// Display the widget on the standard output, and return a handle for further interaction. | ||
fn text(self) -> Self::Handle; | ||
} | ||
|
||
/// A handle to a widget that allows for further interaction. | ||
pub trait WidgetHandle { | ||
#[doc(hidden)] | ||
fn weak_progress_bar(&self) -> Option<WeakProgressBar>; | ||
} |