Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map of arbitrary data to hold unordered state for `layout.List` items. This allows Gio programs to re-use a buffer of states for lists items in between frames. It is a grow-only buffer that expects entries to stabilise.
This is designed along 2 constraints: 1. Performance 2. Type ambiguity
Since Go doesn't have generics, I decided to give the caller type control by using `unsafe.Pointer`.
The caller only has to ensure that the type they initialise it with is the type they attempt to cast out of it. Since the scope of use is small, this invariant is straightforward to uphold.
Nonetheless, this style of API is primarily motivated by re-use concerns when using common patterns in Gio (specifically `layout.List` state management). The static approach would be to copy-paste the same structures with different types every time you have list state to manage.
In light of Go generics incoming, this may become a moot issue. In the meantime this remains an experimental API that functions as expected.
func (*Map) Begin ¶
func (m *Map) Begin()
Begin prepares the map to be accessed. Require to reset iteration state each frame.