luaur_analysis/methods/set_count.rs
1//! Node: `cxx:Method:Luau.Analysis:Analysis/include/Luau/Set.h:93:set_count`
2//! Source: `Analysis/include/Luau/Set.h:93-97` (hand-ported)
3
4use crate::records::set::Set;
5
6impl<T: Clone + core::hash::Hash + PartialEq> Set<T> {
7 /// C++ `size_t count(const T& element) const`.
8 pub fn count(&self, element: &T) -> usize {
9 match self.mapping.find(element) {
10 Some(entry) if *entry => 1,
11 _ => 0,
12 }
13 }
14}