MCPcopy Index your code
hub / github.com/endbasic/endbasic / init

Method init

std/src/console/spec.rs:126–149  ·  view source on GitHub ↗

Initializes the console specification parser from `s`. `s` *must* not be empty. The caller must supply, at least, a default console driver name if the user did not specify any console flag.

(s: &'a str)

Source from the content-addressed store, hash-verified

124 /// `s` *must* not be empty. The caller must supply, at least, a default console driver name
125 /// if the user did not specify any console flag.
126 pub fn init(s: &'a str) -> Self {
127 assert!(!s.is_empty());
128
129 let (driver, rest) = s.split_once(':').unwrap_or((s, ""));
130
131 let mut flags = HashSet::default();
132 let mut keyed_flags = HashMap::default();
133 for pair in rest.split(',') {
134 if pair.is_empty() {
135 continue;
136 }
137
138 match pair.split_once('=') {
139 None => {
140 let _exists = flags.insert(pair);
141 }
142 Some((k, v)) => {
143 let _old = keyed_flags.insert(k, v);
144 }
145 }
146 }
147
148 Self { driver, flags, keyed_flags }
149 }
150
151 /// Queries whether the boolean `flag` is in the specification or not.
152 ///

Callers

nothing calls this directly

Calls 2

is_emptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected