hypergraph/core/
indexes.rs1use std::fmt::{
2 Display,
3 Formatter,
4 Result,
5};
6
7#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
11pub struct VertexIndex(pub usize);
12
13impl Display for VertexIndex {
14 fn fmt(&self, formatter: &mut Formatter<'_>) -> Result {
15 write!(formatter, "{}", self.0)
16 }
17}
18
19impl From<usize> for VertexIndex {
20 fn from(index: usize) -> Self {
21 VertexIndex(index)
22 }
23}
24
25#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub struct HyperedgeIndex(pub usize);
30
31impl Display for HyperedgeIndex {
32 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
33 write!(f, "{}", self.0)
34 }
35}
36
37impl From<usize> for HyperedgeIndex {
38 fn from(index: usize) -> Self {
39 HyperedgeIndex(index)
40 }
41}