Function from_device

Source
pub fn from_device(
    device: Arc<Device>,
    poll_interval: Duration,
) -> ReadingStream
Expand description

Create a stream from a device without needing the trait import.

This is a convenience function for creating a polling stream.

§Example

use std::sync::Arc;
use std::time::Duration;
use aranet_core::{Device, streaming};

let device = Arc::new(Device::connect("Aranet4 12345").await?);
let stream = streaming::from_device(device, Duration::from_secs(5));