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