MCPcopy Create free account
hub / github.com/apache/datafusion / read_line

Method read_line

benchmarks/src/sql_benchmark.rs:1185–1205  ·  view source on GitHub ↗

Read the next line, applying replacements and removing line terminators.

(&mut self, line: &mut String)

Source from the content-addressed store, hash-verified

1183
1184 /// Read the next line, applying replacements and removing line terminators.
1185 fn read_line(&mut self, line: &mut String) -> Option<Result<()>> {
1186 match self.reader.read_line(line) {
1187 Ok(0) => None,
1188 Ok(_) => {
1189 self.line_nr += 1;
1190
1191 // Trim newline and carriage return without changing other content.
1192 let trimmed_len = line.trim_end_matches(['\n', '\r']).len();
1193 line.truncate(trimmed_len);
1194
1195 match process_replacements(line, &self.replacements) {
1196 Ok(l) => {
1197 *line = l;
1198 Some(Ok(()))
1199 }
1200 Err(error) => Some(Err(error)),
1201 }
1202 }
1203 Err(e) => Some(Err(e.into())),
1204 }
1205 }
1206
1207 fn format_exception(&self, msg: &str) -> String {
1208 format!("{}:{} - {}", self.path.display(), self.line_nr, msg)

Callers 7

readline_directFunction · 0.80
process_fileMethod · 0.80
process_assertMethod · 0.80
process_result_queryMethod · 0.80
process_templateMethod · 0.80
read_query_from_readerFunction · 0.80

Calls 4

process_replacementsFunction · 0.85
lenMethod · 0.45
truncateMethod · 0.45
intoMethod · 0.45

Tested by

no test coverage detected