Trait idmap::table::EntryIterable [−][src]
pub unsafe trait EntryIterable<K, V> {
type Iter: Iterator<Item = (TableIndex, *const (K, V))> + Clone;
unsafe fn unchecked_entries(&self) -> Self::Iter;
}
Expand description
Allows iteration over pointers to all a IdTable’s valid entries.
This trait is completely unsafe and has to use raw pointers, since there’s currently no way for a trait to express that the iterators it returns are bound to the lifetime of the struct.
Using the either the iterator or the values it return beyond the lifetime of the reference to
the iterable is undefined behavior the compiler can’t check your for,
so it’s recommended to use the safe wrappers SafeEntries
and SafeEntriesMut
However, it can be safely wrapped in SafeEntries
and SafeEntriesMut
traits.
Safety
The return pointers must be correctly associated with the table for the safe wrappers to yield the correct lifetimes
Associated Types
Required methods
unsafe fn unchecked_entries(&self) -> Self::Iter
unsafe fn unchecked_entries(&self) -> Self::Iter
Iterate over raw pointers in this table
Safety
The returned pointers must never be used past the lifetime for which they are actually valid