heim icon indicating copy to clipboard operation
heim copied to clipboard

Can't use `sensors::temperatures` function in different thread

Open ravenclaw900 opened this issue 2 years ago • 0 comments

If the sensors::temperatures function is spawned into a different thread, it fails with implementation of `std::ops::FnOnce` is not general enough.

MWE:

use futures::StreamExt;
use heim::sensors;

#[tokio::main]
async fn main() {
    tokio::spawn(async {
        sensors::temperatures()
            .collect::<Vec<Result<sensors::TemperatureSensor, heim::Error>>>()
            .await
    });
}

ravenclaw900 avatar Nov 27 '21 13:11 ravenclaw900