1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use crate::builder::CycleBuilder;
use super::{Edge, Surface};
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Cycle {
surface: Surface,
edges: Vec<Edge>,
}
impl Cycle {
pub fn build(surface: Surface) -> CycleBuilder {
CycleBuilder::new(surface)
}
pub fn new(surface: Surface) -> Self {
Self {
surface,
edges: Vec::new(),
}
}
pub fn with_edges(mut self, edges: impl IntoIterator<Item = Edge>) -> Self {
self.edges.extend(edges);
self
}
pub fn surface(&self) -> &Surface {
&self.surface
}
pub fn edges(&self) -> impl Iterator<Item = &Edge> + '_ {
self.edges.iter()
}
pub fn into_edges(self) -> impl Iterator<Item = Edge> {
self.edges.into_iter()
}
}