Skip to main content

des_sim/source_handler/
fired.rs

1//! The `fired` module defines `SourceReadyEntry`, a structure representing
2//! a source that is ready to be processed by the simulation engine.
3//!
4//! This entry contains the source's unique ID and its name, providing essential
5//! information for handling and tracking active sources.
6
7use crate::primitive::id::SourceId;
8use std::sync::Arc;
9
10/// Represents an entry for a source that is ready to be utilized in the simulation.
11#[derive(Debug)]
12pub struct SourceReadyEntry {
13    source_id: SourceId,
14    name: Arc<str>,
15}
16
17impl SourceReadyEntry {
18    /// Creates a new `SourceReadyEntry`.
19    pub(crate) fn new(source_id: SourceId, name: Arc<str>) -> Self {
20        Self { source_id, name }
21    }
22
23    /// Returns the unique identifier of the source.
24    pub fn source_id(&self) -> SourceId {
25        self.source_id
26    }
27
28    /// Returns a string slice representing the name of the source.
29    pub fn name(&self) -> &str {
30        self.name.as_ref()
31    }
32
33    /// Returns a cloned `Arc` pointer to the source's name.
34    pub(crate) fn clone_name_arc(&self) -> Arc<str> {
35        Arc::clone(&self.name)
36    }
37}