disposition_input_ir_rt 0.2.0

Logic to map `disposition` input model to intermediate representation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use disposition_ir_model::edge::EdgeId;
use disposition_model_common::{edge::EdgeGroupId, Id};

/// Generates `EdgeId`s for edges in an edge group.
pub struct EdgeIdGenerator;

impl EdgeIdGenerator {
    /// Generates an `EdgeId` from an edge group ID and edge index.
    ///
    /// Format: `"{edge_group_id}__{edge_index}"`
    pub fn generate<'id>(edge_group_id: &EdgeGroupId<'id>, edge_index: usize) -> EdgeId<'id> {
        let edge_id_str = format!("{edge_group_id}__{edge_index}");
        Id::try_from(edge_id_str)
            .expect("edge ID should be valid")
            .into()
    }
}