MCPcopy Create free account
hub / github.com/davidblewett/rure-python / flag_state

Method flag_state

regex/regex-syntax/src/ast/mod.rs:1302–1316  ·  view source on GitHub ↗

Returns the state of the given flag in this set. If the given flag is in the set but is negated, then `Some(false)` is returned. If the given flag is in the set and is not negated, then `Some(true)` is returned. Otherwise, `None` is returned.

(&self, flag: Flag)

Source from the content-addressed store, hash-verified

1300 ///
1301 /// Otherwise, `None` is returned.
1302 pub fn flag_state(&self, flag: Flag) -> Option<bool> {
1303 let mut negated = false;
1304 for x in &self.items {
1305 match x.kind {
1306 FlagsItemKind::Negation => {
1307 negated = true;
1308 }
1309 FlagsItemKind::Flag(ref xflag) if xflag == &flag => {
1310 return Some(!negated);
1311 }
1312 _ => {}
1313 }
1314 }
1315 None
1316 }
1317}
1318
1319/// A single item in a group of flags.

Callers 1

push_groupMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected