Typeslot
Assigns each type a unique usize index at startup, with optional group compartmentalization.
Usage
use *;
// Define group markers.
;
;
// Derive `TypeSlot` on your types.
;
;
;
// A type can belong to multiple groups.
;
// Call `init_slot` once per group before accessing slots.
// It returns the number of slots assigned in the group.
let element_count = ;
let resource_count = ;
assert_eq!; // Horizontal, Vertical, Label
assert_eq!; // Health, Label
// Use SlotGroup for ergonomic access without repeating the group type.
let elements = new;
let resources = new;
println!;
println!;
// Or use the free functions directly.
println!;
println!;
Join the community!
You can join us on the Voxell discord server.
License
typeslot is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both.