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

Method next_back

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

Source from the content-addressed store, hash-verified

859
860impl<'a> DoubleEndedIterator for Components<'a> {
861 fn next_back(&mut self) -> Option<Component<'a>> {
862 while !self.finished() {
863 match self.back {
864 State::Body if self.path.len() > self.len_before_body() => {
865 let (size, comp) = self.parse_next_component_back();
866 self.path = &self.path[..self.path.len() - size];
867 if comp.is_some() {
868 return comp;
869 }
870 }
871 State::Body => {
872 self.back = State::StartDir;
873 }
874 State::StartDir => {
875 if self.has_physical_root {
876 self.path = &self.path[..self.path.len() - 1];
877 return Some(Component::RootDir);
878 } else if self.include_cur_dir() {
879 self.path = &self.path[..self.path.len() - 1];
880 return Some(Component::CurDir);
881 }
882 }
883 State::Done => unreachable!(),
884 }
885 }
886 None
887 }
888}
889
890impl<'a> cmp::PartialEq for Components<'a> {

Callers 2

parentMethod · 0.80
file_nameMethod · 0.80

Calls 5

finishedMethod · 0.80
len_before_bodyMethod · 0.80
include_cur_dirMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected