shacl_ir/components/
or.rs1use crate::shape_label_idx::ShapeLabelIdx;
2use std::fmt::Display;
3
4#[derive(Debug, Clone)]
11pub struct Or {
12 shapes: Vec<ShapeLabelIdx>,
13}
14
15impl Or {
16 pub fn new(shapes: Vec<ShapeLabelIdx>) -> Self {
17 Or { shapes }
18 }
19
20 pub fn shapes(&self) -> &Vec<ShapeLabelIdx> {
21 &self.shapes
22 }
23}
24
25impl Display for Or {
26 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 write!(
28 f,
29 "Or[{}]",
30 self.shapes()
31 .iter()
32 .map(|s| s.to_string())
33 .collect::<Vec<_>>()
34 .join(", ")
35 )
36 }
37}