MCPcopy Create free account
hub / github.com/PRQL/prql / new

Method new

prqlc/prqlc/src/lib.rs:470–485  ·  view source on GitHub ↗
(iter: I, root: Option<PathBuf>)

Source from the content-addressed store, hash-verified

468 }
469
470 pub fn new<I>(iter: I, root: Option<PathBuf>) -> Self
471 where
472 I: IntoIterator<Item = (PathBuf, String)>,
473 {
474 let mut res = SourceTree {
475 sources: HashMap::new(),
476 source_ids: HashMap::new(),
477 root,
478 };
479
480 for (index, (path, content)) in iter.into_iter().enumerate() {
481 res.sources.insert(path.clone(), content);
482 res.source_ids.insert((index + 1) as u16, path);
483 }
484 res
485 }
486
487 pub fn insert(&mut self, path: PathBuf, content: String) {
488 let last_id = self.source_ids.keys().max().cloned().unwrap_or(0);

Callers

nothing calls this directly

Calls 2

into_iterMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected