MCPcopy Create free account
hub / github.com/evilsocket/cake / take_slot

Method take_slot

cake-core/src/models/vibevoice/vae_decoder.rs:36–44  ·  view source on GitHub ↗

Take the next cache slot, returning (index, is_first_use).

(&mut self)

Source from the content-addressed store, hash-verified

34
35 /// Take the next cache slot, returning (index, is_first_use).
36 pub fn take_slot(&mut self) -> (usize, bool) {
37 let idx = self.counter;
38 self.counter += 1;
39 if idx >= self.states.len() {
40 self.states.resize(idx + 1, None);
41 }
42 let is_first = self.states[idx].is_none();
43 (idx, is_first)
44 }
45
46 pub fn get(&self, idx: usize) -> Option<&Tensor> {
47 self.states.get(idx).and_then(|s| s.as_ref())

Calls

no outgoing calls