Get rid of unwraps

This commit is contained in:
meehl committed 2026-08-27 18:02:24 +02:00
1 parent 8cfc82d668
commit 6f0eef7cf8
2 files changed
+9 -7

No files matched your search

+4 -2
View File
@@ -1,3 +1,5 @@
use std::num::NonZeroU32;
use ahash::HashMap;
use crate::{
@@ -37,12 +39,12 @@ impl BatchBuilder {
///
/// Returns slot_index into textures array if texture can be assigned.
/// Returns `None` if maximum amount of texture slots is reached.
fn try_assign(&mut self, id: TextureId, max_slots: u32) -> Option<u32> {
fn try_assign(&mut self, id: TextureId, max_slots: NonZeroU32) -> Option<u32> {
if let Some(&slot) = self.texture_mapping.get(&id) {
return Some(slot);
}
if self.textures.len() as u32 >= max_slots {
if self.textures.len() as u32 >= max_slots.get() {
return None;
}