luaur_analysis/records/const_iterator.rs
1//! Generated skeleton item.
2//! Node: `cxx:Record:Luau.Analysis:Analysis/include/Luau/Set.h:132:const_iterator`
3//! Source: `Analysis/include/Luau/Set.h`
4//! Graph edges:
5//! - declared_by: source_file Analysis/include/Luau/Set.h
6//! - source_includes:
7//! - includes -> source_file Common/include/Luau/Common.h
8//! - includes -> source_file Common/include/Luau/DenseHash.h
9//! - incoming:
10//! - declares <- source_file Analysis/include/Luau/Set.h
11//! - type_ref <- record Set (Analysis/include/Luau/Set.h)
12//! - type_ref <- type_alias iterator (Analysis/include/Luau/Set.h)
13//! - type_ref <- method Set::begin (Analysis/include/Luau/Set.h)
14//! - type_ref <- method Set::end (Analysis/include/Luau/Set.h)
15//! - type_ref <- method Set::const_iterator::const_iterator (Analysis/include/Luau/Set.h)
16//! - type_ref <- method Set::const_iterator::operator== (Analysis/include/Luau/Set.h)
17//! - type_ref <- method Set::const_iterator::operator!= (Analysis/include/Luau/Set.h)
18//! - type_ref <- method Set::const_iterator::operator++ (Analysis/include/Luau/Set.h)
19//! - type_ref <- method Set::const_iterator::operator++ (Analysis/include/Luau/Set.h)
20//! - type_ref <- type_alias const_iterator (Analysis/include/Luau/TypeIds.h)
21//! - outgoing:
22//! - type_ref -> type_alias const_iterator (Analysis/include/Luau/TypeIds.h)
23//! - translates_to -> rust_item const_iterator
24
25extern crate alloc;
26
27use alloc::boxed::Box;
28
29// C++ Set<T>::const_iterator (Set.h:132-191): forward iteration over the
30// underlying DenseHashMap<T, bool>, skipping tombstoned (false) entries. The
31// skip-false filter is applied where Set::begin constructs this (the C++ ctor
32// and operator++ both skip); the boxed inner iterator carries it.
33pub struct ConstIterator<'a, T> {
34 pub(crate) inner: Box<dyn Iterator<Item = &'a T> + 'a>,
35}
36
37impl<'a, T> ConstIterator<'a, T> {
38 pub fn new(inner: Box<dyn Iterator<Item = &'a T> + 'a>) -> Self {
39 Self { inner }
40 }
41}
42
43impl<'a, T> Iterator for ConstIterator<'a, T> {
44 type Item = &'a T;
45
46 fn next(&mut self) -> Option<&'a T> {
47 self.inner.next()
48 }
49}
50
51impl<T> core::fmt::Debug for ConstIterator<'_, T> {
52 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
53 f.write_str("ConstIterator")
54 }
55}