shapemap/
shapemap.rs

1use crate::shapemap_state::*;
2use std::collections::HashSet;
3
4/// A ShapeMap is based on [shape maps specification](https://shexspec.github.io/shape-map/)
5/// This trait is the more abstract representation of a shape map which is an association of nodes with shapes, whose values are a [ShapeMapState]
6pub trait ShapeMap {
7    type NodeIdx;
8    type ShapeIdx;
9
10    //    fn next_pending_pair(&self) -> Option<(&Self::NodeIdx, &Self::ShapeIdx)>;
11
12    fn nodes_conform(&self, shape: &Self::ShapeIdx) -> HashSet<&Self::NodeIdx>;
13
14    fn state(&self, node: &Self::NodeIdx, shape: &Self::ShapeIdx) -> &ShapeMapState;
15
16    fn nodes(&self) -> HashSet<&Self::NodeIdx>;
17
18    fn shapes(&self) -> HashSet<&Self::ShapeIdx>;
19
20    fn add_pending(&mut self, node: &Self::NodeIdx, shape: &Self::ShapeIdx);
21
22    fn add_conforms(&mut self, node: &Self::NodeIdx, shape: &Self::ShapeIdx);
23
24    fn add_fails(&mut self, node: &Self::NodeIdx, shape: &Self::ShapeIdx);
25}