28 lines
838 B
Rust
28 lines
838 B
Rust
//! Data models for sprinklers zones
|
|
//!
|
|
//! A zone represents a group of sprinkler heads actuated by a single
|
|
//! valve. Physically controllable (or virtual) valves are handled by implementations of
|
|
//! [ZoneInterface](../../zone_interface/trait.ZoneInterface.html), but the model
|
|
//! describes a logical zone and how it maps to a physical one.
|
|
|
|
use crate::zone_interface::ZoneNum;
|
|
use serde::{Deserialize, Serialize};
|
|
use std::sync::Arc;
|
|
|
|
/// Identifying integer type for a Zone
|
|
pub type ZoneId = u32;
|
|
|
|
/// A single logical zone
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Zone {
|
|
pub id: ZoneId,
|
|
pub name: String,
|
|
/// ID number of the corresponding physical zone
|
|
pub interface_id: ZoneNum,
|
|
}
|
|
|
|
pub type ZoneRef = Arc<Zone>;
|
|
|
|
pub type Zones = im::OrdMap<ZoneId, ZoneRef>;
|