Rename Confirmer to UIThread

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-10 13:45:20 +10:00
parent 9349fbabdc
commit 88c3f15b3f
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
3 changed files with 16 additions and 16 deletions

View file

@ -6,7 +6,7 @@ use tokio::task::spawn_blocking;
use crate::BinstallError;
#[derive(Debug)]
struct ConfirmerInner {
struct UIThreadInner {
/// Request for confirmation
request_tx: mpsc::Sender<()>,
@ -14,7 +14,7 @@ struct ConfirmerInner {
confirm_rx: mpsc::Receiver<Result<(), BinstallError>>,
}
impl ConfirmerInner {
impl UIThreadInner {
fn new() -> Self {
let (request_tx, mut request_rx) = mpsc::channel(1);
let (confirm_tx, confirm_rx) = mpsc::channel(10);
@ -75,13 +75,13 @@ impl ConfirmerInner {
}
#[derive(Debug)]
pub struct Confirmer(Option<ConfirmerInner>);
pub struct UIThread(Option<UIThreadInner>);
impl Confirmer {
impl UIThread {
/// * `enable` - `true` to enable confirmation, `false` to disable it.
pub fn new(enable: bool) -> Self {
Self(if enable {
Some(ConfirmerInner::new())
Some(UIThreadInner::new())
} else {
None
})