Struct MockDeviceBuilder

Source
pub struct MockDeviceBuilder { /* private fields */ }
Expand description

Builder for creating mock devices with custom settings.

Implementations§

Source§

impl MockDeviceBuilder

Source

pub fn new() -> Self

Create a new builder.

Source

pub fn name(self, name: &str) -> Self

Set the device name.

Source

pub fn device_type(self, device_type: DeviceType) -> Self

Set the device type.

Source

pub fn co2(self, co2: u16) -> Self

Set the CO2 level.

Source

pub fn temperature(self, temp: f32) -> Self

Set the temperature.

Source

pub fn pressure(self, pressure: f32) -> Self

Set the pressure.

Source

pub fn humidity(self, humidity: u8) -> Self

Set the humidity.

Source

pub fn battery(self, battery: u8) -> Self

Set the battery level.

Source

pub fn status(self, status: Status) -> Self

Set the status.

Source

pub fn auto_connect(self, auto: bool) -> Self

Set whether to auto-connect.

Source

pub fn radon(self, radon: u32) -> Self

Set radon concentration in Bq/m³ (AranetRn+ devices).

Source

pub fn radon_avg_24h(self, avg: u32) -> Self

Set 24-hour average radon concentration in Bq/m³ (AranetRn+ devices).

Source

pub fn radon_avg_7d(self, avg: u32) -> Self

Set 7-day average radon concentration in Bq/m³ (AranetRn+ devices).

Source

pub fn radon_avg_30d(self, avg: u32) -> Self

Set 30-day average radon concentration in Bq/m³ (AranetRn+ devices).

Source

pub fn radiation_rate(self, rate: f32) -> Self

Set radiation dose rate in µSv/h (Aranet Radiation devices).

Source

pub fn radiation_total(self, total: f64) -> Self

Set total radiation dose in mSv (Aranet Radiation devices).

Source

pub fn build(self) -> MockDevice

Build the mock device.

Note: This is a sync method that sets initial state directly. The device is created with the specified reading already set.

Trait Implementations§

Source§

impl Debug for MockDeviceBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MockDeviceBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more