MCPcopy Create free account
hub / github.com/hashintel/hash / insert

Method insert

libs/@local/hashql/core/src/id/bit_vec/mod.rs:203–216  ·  view source on GitHub ↗
(&mut self, elem: T)

Source from the content-addressed store, hash-verified

201 /// Panics if `elem` is out of bounds.
202 #[inline]
203 pub fn insert(&mut self, elem: T) -> bool {
204 assert!(
205 elem.as_usize() < self.domain_size,
206 "inserting element at index {} but domain size is {}",
207 elem.as_usize(),
208 self.domain_size,
209 );
210 let (word_index, mask) = word_index_and_mask(elem.as_usize());
211 let word_ref = &mut self.words[word_index];
212 let word = *word_ref;
213 let new_word = word | mask;
214 *word_ref = new_word;
215 new_word != word
216 }
217
218 #[inline]
219 pub fn set(&mut self, elem: T, value: bool) -> bool {

Callers 15

setMethod · 0.45
bitset_iter_worksFunction · 0.45
bitset_iter_works_2Function · 0.45
bitset_clone_fromFunction · 0.45
union_notFunction · 0.45
chunked_bitsetFunction · 0.45
dense_last_set_beforeFunction · 0.45
dense_contains_anyFunction · 0.45
dense_first_unsetFunction · 0.45
finite.rsFile · 0.45
insert_and_containsFunction · 0.45

Calls 6

word_index_and_maskFunction · 0.85
chunk_indexFunction · 0.85
chunk_domain_sizeMethod · 0.80
as_usizeMethod · 0.45
ensureMethod · 0.45

Tested by 15

bitset_iter_worksFunction · 0.36
bitset_iter_works_2Function · 0.36
bitset_clone_fromFunction · 0.36
union_notFunction · 0.36
chunked_bitsetFunction · 0.36
dense_last_set_beforeFunction · 0.36
dense_contains_anyFunction · 0.36
dense_first_unsetFunction · 0.36
insert_and_containsFunction · 0.36
iter_exact_sizeFunction · 0.36
union_combines_bitsFunction · 0.36