hardware_toolkit/src/utils/step_downloader.rs

38 lines
1.0 KiB
Rust
Raw Normal View History

2025-06-28 16:43:09 +08:00
use log::info;
use std::time::Duration;
use iced::task::{Never, Sipper, sipper};
pub struct StepDownloader {
nothing: String,
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum StepDownloaderMsg {
Nothing,
SearchKeyword(String),
}
#[derive(Debug, Clone)]
pub enum StepDownloaderEvent {
Nothing,
}
impl StepDownloader {
pub fn create_process() -> impl Sipper<Never, StepDownloaderEvent> {
info!("Start create the process.");
sipper(async |mut output| {
loop {
output.send(StepDownloaderEvent::Nothing).await;
info!("In process print once.");
loop {
info!("In process print tick A.");
tokio::time::sleep(Duration::from_millis(1000)).await;
// output.send(StepDownloaderEvent::Nothing).await;
info!("In process print tick A.");
tokio::time::sleep(Duration::from_millis(1000)).await;
}
}
})
}
}