mirror of
				https://github.com/edera-dev/krata.git
				synced 2025-11-03 23:29:39 +00:00 
			
		
		
		
	async-ify xenstore and xenclient
This commit is contained in:
		@ -1,13 +1,15 @@
 | 
			
		||||
use std::{thread::sleep, time::Duration};
 | 
			
		||||
use std::time::Duration;
 | 
			
		||||
 | 
			
		||||
use anyhow::Result;
 | 
			
		||||
use kratanet::autonet::AutoNetworkCollector;
 | 
			
		||||
use tokio::time::sleep;
 | 
			
		||||
 | 
			
		||||
fn main() -> Result<()> {
 | 
			
		||||
    let mut collector = AutoNetworkCollector::new()?;
 | 
			
		||||
#[tokio::main]
 | 
			
		||||
async fn main() -> Result<()> {
 | 
			
		||||
    let mut collector = AutoNetworkCollector::new().await?;
 | 
			
		||||
    loop {
 | 
			
		||||
        let changeset = collector.read_changes()?;
 | 
			
		||||
        let changeset = collector.read_changes().await?;
 | 
			
		||||
        println!("{:?}", changeset);
 | 
			
		||||
        sleep(Duration::from_secs(2));
 | 
			
		||||
        sleep(Duration::from_secs(2)).await;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user