MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / alloc

Method alloc

native/shared/src/handles.rs:17–25  ·  view source on GitHub ↗

Allocate a handle for the given item. Returns a 1-based index as f64.

(&mut self, item: T)

Source from the content-addressed store, hash-verified

15
16 /// Allocate a handle for the given item. Returns a 1-based index as f64.
17 pub fn alloc(&mut self, item: T) -> f64 {
18 if let Some(idx) = self.free_list.pop() {
19 self.items[idx] = Some(item);
20 (idx + 1) as f64
21 } else {
22 self.items.push(Some(item));
23 self.items.len() as f64
24 }
25 }
26
27 /// Get a reference to the item at the given handle.
28 pub fn get(&self, handle: f64) -> Option<&T> {

Callers 15

bloom_commit_textureFunction · 0.80
bloom_commit_modelFunction · 0.80
bloom_commit_textureFunction · 0.80
bloom_commit_modelFunction · 0.80
bloom_commit_textureFunction · 0.80
bloom_commit_modelFunction · 0.80
bloom_commit_textureFunction · 0.80
bloom_commit_modelFunction · 0.80
load_soundMethod · 0.80
load_musicMethod · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected