MCPcopy Create free account
hub / github.com/corrode/write-yourself-a-shell / parse

Method parse

examples/final.rs:31–42  ·  view source on GitHub ↗
(command: &'a str)

Source from the content-addressed store, hash-verified

29
30impl<'a> Chain<'a> {
31 fn parse(command: &'a str) -> Option<Self> {
32 let mut tokens = command.split_whitespace().peekable();
33 let mut elements = vec![];
34 while let Some(e) = Element::parse_next(&mut tokens) {
35 elements.push(e);
36 }
37 if !elements.is_empty() {
38 Some(Self { elements })
39 } else {
40 None
41 }
42 }
43
44 fn run(self) {
45 let mut prev_output: Option<Output> = None;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected