MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / next

Method next

euralios_std/src/path.rs:828–857  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

826 type Item = Component<'a>;
827
828 fn next(&mut self) -> Option<Component<'a>> {
829 while !self.finished() {
830 match self.front {
831 State::StartDir => {
832 self.front = State::Body;
833 if self.has_physical_root {
834 debug_assert!(!self.path.is_empty());
835 self.path = &self.path[1..];
836 return Some(Component::RootDir);
837 } else if self.include_cur_dir() {
838 debug_assert!(!self.path.is_empty());
839 self.path = &self.path[1..];
840 return Some(Component::CurDir);
841 }
842 }
843 State::Body if !self.path.is_empty() => {
844 let (size, comp) = self.parse_next_component();
845 self.path = &self.path[size..];
846 if comp.is_some() {
847 return comp;
848 }
849 }
850 State::Body => {
851 self.front = State::Done;
852 }
853 State::Done => unreachable!(),
854 }
855 }
856 None
857 }
858}
859
860impl<'a> DoubleEndedIterator for Components<'a> {

Callers 1

include_cur_dirMethod · 0.45

Calls 3

finishedMethod · 0.80
include_cur_dirMethod · 0.80
parse_next_componentMethod · 0.80

Tested by

no test coverage detected