Inserts a new value `T` into this table, returning a corresponding `Resource ` which can be used to refer to it after it was inserted.
(&mut self, entry: T)
| 153 | /// Inserts a new value `T` into this table, returning a corresponding |
| 154 | /// `Resource<T>` which can be used to refer to it after it was inserted. |
| 155 | pub fn push<T>(&mut self, entry: T) -> Result<Resource<T>, ResourceTableError> |
| 156 | where |
| 157 | T: Send + 'static, |
| 158 | { |
| 159 | let idx = self.push_(TableEntry::new(Box::new(entry), None))?; |
| 160 | Ok(Resource::new_own(idx)) |
| 161 | } |
| 162 | |
| 163 | /// Pop an index off of the free list, if it's not empty. |
| 164 | fn pop_free_list(&mut self) -> Option<usize> { |