struct IterRefCounter
Declaration
struct IterRefCounter { /* full declaration omitted */ };
Description
Reference counting outstanding iterators (and view types since they need to be able to produce iterators) in order to catch iterator invalidation and prevent them from being used afterward. Mutating the collection should check that the `count` is empty. This is much like a `RefCell` in Rust, using runtime verfication that modification does not occur while there are outstanding references.
Declared at: sus/iter/iterator_ref.h:79
Method Overview
- public constexpr sus::num::usize count_from_owner() const noexcept
- public static constexpr sus::iter::IterRefCounter empty_for_view() noexcept
- public static constexpr sus::iter::IterRefCounter for_owner() noexcept
- public constexpr sus::iter::IterRefCounter take_for_owner() & noexcept
- public constexpr sus::iter::IterRefCounter take_for_view() & noexcept
- public constexpr sus::iter::IterRef to_iter_from_owner() const noexcept
- public constexpr sus::iter::IterRef to_iter_from_view() const noexcept
- public constexpr sus::iter::IterRefCounter to_view_from_owner() const noexcept
- public constexpr sus::iter::IterRefCounter to_view_from_view() const noexcept
Methods
¶constexpr sus::num::usize count_from_owner()
const noexcept
constexpr sus::num::usize count_from_owner()
const noexcept
Description
Only valid to be called on owning collections such as Vec.
Declared at: sus/iter/iterator_ref.h:107
¶static constexpr sus::iter::IterRefCounter
empty_for_view() noexcept
static constexpr sus::iter::IterRefCounter
empty_for_view() noexcept
Declared at: sus/iter/iterator_ref.h:83
¶static constexpr sus::iter::IterRefCounter
for_owner() noexcept
static constexpr sus::iter::IterRefCounter
for_owner() noexcept
Declared at: sus/iter/iterator_ref.h:80
¶constexpr sus::iter::IterRefCounter
take_for_owner() & noexcept
constexpr sus::iter::IterRefCounter
take_for_owner() & noexcept
Description
Resets self to no ref counts, returning a new IterRefCounter containing the old ref counts. Only valid to be called on owning collections such as Vec.
Declared at: sus/iter/iterator_ref.h:113
¶constexpr sus::iter::IterRefCounter
take_for_view() & noexcept
constexpr sus::iter::IterRefCounter
take_for_view() & noexcept
Description
Resets self to no pointer to a ref count, returning a new IterRefCounter containing the old pointetr.
Declared at: sus/iter/iterator_ref.h:119
¶constexpr sus::iter::IterRef to_iter_from_owner()
const noexcept
constexpr sus::iter::IterRef to_iter_from_owner()
const noexcept
Description
Only valid to be called on owning collections such as Vec.
Declared at: sus/iter/iterator_ref.h:88
¶constexpr sus::iter::IterRef to_iter_from_view()
const noexcept
constexpr sus::iter::IterRef to_iter_from_view()
const noexcept
Description
Only valid to be called on non-owning views such as Slice.
Declared at: sus/iter/iterator_ref.h:92
¶constexpr sus::iter::IterRefCounter
to_view_from_owner() const noexcept
constexpr sus::iter::IterRefCounter
to_view_from_owner() const noexcept
Description
Only valid to be called on owning collections such as Vec.
Declared at: sus/iter/iterator_ref.h:97
¶constexpr sus::iter::IterRefCounter
to_view_from_view() const noexcept
constexpr sus::iter::IterRefCounter
to_view_from_view() const noexcept
Description
Only valid to be called on non-owning views such as Slice.
Declared at: sus/iter/iterator_ref.h:101