nexrad_data/aws/realtime/volume_index.rs
1/// A volume's index in the AWS real-time NEXRAD bucket. These indexes are rotated-through as chunks
2/// are accumulated and finally combined into full volumes to be archived.
3#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4pub struct VolumeIndex(usize);
5
6impl VolumeIndex {
7 /// Creates a new volume index with the specified value.
8 pub fn new(index: usize) -> Self {
9 debug_assert!(index <= 999, "Volume index must be <= 999");
10 Self(index)
11 }
12
13 /// Returns the volume index as a number.
14 pub fn as_number(&self) -> usize {
15 self.0
16 }
17}