manifold_graph/
integration.rs1use crate::{AllEdgesIter, Edge, GraphTableRead};
4use manifold::StorageError;
5
6pub trait EdgeSource {
11 type Iter<'a>: Iterator<Item = Result<Edge, StorageError>>
13 where
14 Self: 'a;
15
16 fn all_edges(&self) -> Result<Self::Iter<'_>, StorageError>;
20
21 fn edge_count(&self) -> Result<u64, StorageError>;
23
24 fn is_empty(&self) -> Result<bool, StorageError> {
26 Ok(self.edge_count()? == 0)
27 }
28}
29
30impl EdgeSource for GraphTableRead {
31 type Iter<'a>
32 = AllEdgesIter<'a>
33 where
34 Self: 'a;
35
36 fn all_edges(&self) -> Result<Self::Iter<'_>, StorageError> {
37 GraphTableRead::all_edges(self)
38 }
39
40 fn edge_count(&self) -> Result<u64, StorageError> {
41 self.len()
42 }
43}