tenferro_runtime/program/
import.rs1use std::fmt;
2
3use super::{ProgramBindings, ProgramValue, SemanticProgram};
4
5pub struct ProgramImport<'a> {
7 pub program: &'a SemanticProgram,
9 pub bindings: Option<&'a ProgramBindings>,
15 pub roots: &'a [ProgramValue],
17 pub input_map: &'a [(ProgramValue, ProgramValue)],
23}
24
25impl fmt::Debug for ProgramImport<'_> {
26 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
27 formatter
28 .debug_struct("ProgramImport")
29 .field("program_inputs", &self.program.inputs().len())
30 .field("program_outputs", &self.program.outputs().len())
31 .field("bindings", &self.bindings.map(ProgramBindings::len))
32 .field("roots", &self.roots.len())
33 .field("input_map", &self.input_map.len())
34 .finish()
35 }
36}
37
38pub struct ImportedProgramValues {
40 roots: Box<[ProgramValue]>,
41}
42
43impl ImportedProgramValues {
44 pub(crate) fn new(roots: Box<[ProgramValue]>) -> Self {
45 Self { roots }
46 }
47
48 pub fn roots(&self) -> &[ProgramValue] {
50 &self.roots
51 }
52}
53
54impl fmt::Debug for ImportedProgramValues {
55 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
56 formatter
57 .debug_struct("ImportedProgramValues")
58 .field("roots", &self.roots.len())
59 .finish()
60 }
61}