Skip to main content

des_sim/primitive/id/
source_id.rs

1//! The `source_id` module defines the `SourceId` type, a unique identifier
2//! for each source within the simulation.
3//!
4//! This ID is essential for tracking, referencing, and managing individual
5//! sources throughout their lifecycle.
6
7/// Represents a unique identifier for a simulation source.
8#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
9pub struct SourceId(usize);
10
11impl SourceId {
12    /// Creates a new `SourceId` with the specified value.
13    pub(crate) fn new(value: usize) -> Self {
14        SourceId(value)
15    }
16
17    /// Returns the raw numerical value of the identifier.
18    pub fn value(&self) -> usize {
19        self.0
20    }
21}