MCPcopy Create free account
hub / github.com/daniel-e/rustml / next

Method next

src/io.rs:110–134  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

108 type Item = io::Result<Vec<String>>;
109
110 fn next(&mut self) -> Option<Self::Item> {
111 loop {
112 let mut buf = String::new();
113 match self.reader.read_line(&mut buf) {
114 Ok(0) => {
115 return None
116 },
117 Err(e) => {
118 return Some(Err(e))
119 },
120 Ok(_n) => {
121 // remove new line from end of line
122 if buf.ends_with("\n") {
123 buf.pop();
124 }
125 match self.r.captures(&buf) {
126 Some(cap) => {
127 return Some(Ok(cap.iter().map(|s| s.unwrap().to_string()).collect()));
128 },
129 _ => () // skip line and try next line
130 }
131 }
132 }
133 }
134 }
135
136}
137

Callers

nothing calls this directly

Calls 3

mapMethod · 0.80
to_stringMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected