/// Return an iterator over the graph leaves
Return an iterator over the graph leaves
Return an iterator over the graph leaves
pub fn into_leaves(self) -> impl Iterator<Item = Hex2> {
		struct HexGraphLeaves {
			roots: Vec<HexGraph>,
		}
		impl Iterator for HexGraphLeaves {
			type Item = Hex2;
			fn next(&mut self) -> Option<Self::Item> {
				loop {
					let elt = self.roots.pop()?;
					if elt.block.is_atom() {
						break Some(elt.block.center);
					} else if let Some(children) = elt.children {
						self.roots.extend(children.to_vec().into_iter().rev());
					} else {
						unreachable!()
					}
				}
			}
		}
		HexGraphLeaves { roots: vec![ self ] }
	}
pub fn into_leaves ( self ) -> impl Iterator < Item = Hex2 > { struct HexGraphLeaves { roots : Vec < HexGraph > , } impl Iterator for HexGraphLeaves { type Item = Hex2 ; fn next ( & mut self ) -> Option < Self :: Item > { loop { let elt = self . roots . pop ( ) ? ; if elt . block . is_atom ( ) { break Some ( elt . block . center ) ; } else if let Some ( children ) = elt . children { self . roots . extend ( children . to_vec ( ) . into_iter ( ) . rev ( ) ) ; } else { unreachable ! ( ) } } } } HexGraphLeaves { roots : vec ! [ self ] } }
Return an iterator over the graph leaves
Return an iterator over the graph leaves
self