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

Method parse_next

examples/final.rs:71–78  ·  view source on GitHub ↗
(tokens: &mut Peekable<I>)

Source from the content-addressed store, hash-verified

69
70impl<'a> Element<'a> {
71 fn parse_next<I: Iterator<Item = &'a str>>(tokens: &mut Peekable<I>) -> Option<Self> {
72 tokens
73 .next()
74 .and_then(|next| match Self::parse_operator(next) {
75 Some(operator) => Some(operator),
76 None => Self::parse_cmd(next, tokens).map(Self::Cmd),
77 })
78 }
79
80 fn parse_operator(token: &str) -> Option<Self> {
81 match token {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected