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

Method add_item

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

Add the given item to this sequence of flags. If the item was added successfully, then `None` is returned. If the given item is a duplicate, then `Some(i)` is returned, where `items[i].kind == item.kind`.

(&mut self, item: FlagsItem)

Source from the content-addressed store, hash-verified

1281 /// given item is a duplicate, then `Some(i)` is returned, where
1282 /// `items[i].kind == item.kind`.
1283 pub fn add_item(&mut self, item: FlagsItem) -> Option<usize> {
1284 for (i, x) in self.items.iter().enumerate() {
1285 if x.kind == item.kind {
1286 return Some(i);
1287 }
1288 }
1289 self.items.push(item);
1290 None
1291 }
1292
1293 /// Returns the state of the given flag in this set.
1294 ///

Callers 1

parse_flagsMethod · 0.80

Calls 2

iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected