diff --git a/hui-examples/Cargo.toml b/hui-examples/Cargo.toml index aff99bb..12af401 100644 --- a/hui-examples/Cargo.toml +++ b/hui-examples/Cargo.toml @@ -11,7 +11,7 @@ hui-painter = { path = "../hui-painter" } hui-glium = { path = "../hui-glium" } hui-winit = { path = "../hui-winit" } kubi-logging = { git = "https://github.com/griffi-gh/kubi", rev = "be1e24ba0c9e6d24128e7d0e74bebd8b90c23be7" } -glium = "0.35" +glium = "0.36" winit = "0.30" glam = "0.29" log = "0.4" diff --git a/hui-painter/Cargo.toml b/hui-painter/Cargo.toml index 8500980..8b3d123 100644 --- a/hui-painter/Cargo.toml +++ b/hui-painter/Cargo.toml @@ -19,6 +19,6 @@ hui-shared = { version = "0.1.0-alpha.5", path = "../hui-shared" } glam = "0.29" log = "0.4" rect_packer = "0.2" # TODO: use sth else like `crunch` instead? -hashbrown = "0.14" +hashbrown = "0.15" nohash-hasher = "0.2" fontdue = "0.9" diff --git a/hui-painter/src/text/font.rs b/hui-painter/src/text/font.rs index a84c9fa..f32a24a 100644 --- a/hui-painter/src/text/font.rs +++ b/hui-painter/src/text/font.rs @@ -29,7 +29,7 @@ impl FontHandleManager { /// - If the font data is invalid. pub fn add_font(&mut self, data: &[u8]) -> FontHandle { let font = fontdue::Font::from_bytes(data, fontdue::FontSettings::default()).unwrap(); - self.fonts.insert_unique_unchecked(self.idc, FontRepr { font }); + unsafe { self.fonts.insert_unique_unchecked(self.idc, FontRepr { font }); } self.idc += 1; FontHandle(self.idc - 1) } diff --git a/hui-painter/src/text/ftm.rs b/hui-painter/src/text/ftm.rs index 51570cf..130fc17 100644 --- a/hui-painter/src/text/ftm.rs +++ b/hui-painter/src/text/ftm.rs @@ -46,7 +46,7 @@ impl FontTextureManager { /// - If the partition for the font already exists. pub(crate) fn init_font(&mut self, font: FontHandle) { assert!(!self.partition.contains_key(&font.0), "Font handle already initialized"); - self.partition.insert_unique_unchecked(font.0, HashMap::default()); + unsafe { self.partition.insert_unique_unchecked(font.0, HashMap::default()) }; } /// Render a glyph and cache it in the texture atlas. @@ -81,7 +81,7 @@ impl FontTextureManager { // Create a texture item struct and insert it into the partition let itm = RasterizedGlyphInternal { handle, metrics }; - partition.insert_unique_unchecked(config, itm); + unsafe { partition.insert_unique_unchecked(config, itm); } return handle; } diff --git a/hui-painter/src/texture/atlas.rs b/hui-painter/src/texture/atlas.rs index de06fc1..f9e9398 100644 --- a/hui-painter/src/texture/atlas.rs +++ b/hui-painter/src/texture/atlas.rs @@ -204,12 +204,14 @@ impl TextureAtlas { if allocation.max_size.x >= size.x && allocation.max_size.y >= size.y { let allocation = self.reuse_allocations.remove(idx); let handle = self.next_handle(size); - self.allocations.insert_unique_unchecked(handle.id, TextureAllocation { - handle, - offset: allocation.offset, - size, - max_size: allocation.max_size, - }); + unsafe { + self.allocations.insert_unique_unchecked(handle.id, TextureAllocation { + handle, + offset: allocation.offset, + size, + max_size: allocation.max_size, + }); + } return handle; } } @@ -228,7 +230,9 @@ impl TextureAtlas { // Allocate the texture let handle = self.next_handle(size); let allocation = TextureAllocation::new(handle, offset, size); - self.allocations.insert_unique_unchecked(handle.id, allocation); + unsafe { + self.allocations.insert_unique_unchecked(handle.id, allocation); + } handle } diff --git a/hui/Cargo.toml b/hui/Cargo.toml index e5fdd29..1f3192e 100644 --- a/hui/Cargo.toml +++ b/hui/Cargo.toml @@ -19,16 +19,16 @@ include = [ hui-derive = { version = "0.1.0-alpha.5", path = "../hui-derive", optional = true } hui-shared = { version = "0.1.0-alpha.5", path = "../hui-shared" } # hui-painter = { version = "0.1.0-alpha.5", path = "../hui-painter" } -hashbrown = "0.14" +hashbrown = "0.15" nohash-hasher = "0.2" -glam = "0.29"" +glam = "0.29" fontdue = "0.9" rect_packer = "0.2" log = "0.4" document-features = "0.2" derive_setters = "0.1" -derive_more = "0.99" -tinyset = "0.4" +derive_more = { version = "1.0", features = [ "full" ] } +tinyset = "0.5" image = { version = "0.25", default-features = false, optional = true } rustc-hash = "2.0" diff --git a/hui/src/draw/atlas.rs b/hui/src/draw/atlas.rs index 8ec17bc..73bc2aa 100644 --- a/hui/src/draw/atlas.rs +++ b/hui/src/draw/atlas.rs @@ -163,7 +163,9 @@ impl TextureAtlasManager { //If the size does not match the requested size, the texture was rotated rotated: ALLOW_ROTATION && (result.width != size.x as i32), }; - self.allocations.insert_unique_unchecked(index, allocation); + unsafe { + self.allocations.insert_unique_unchecked(index, allocation); + } Some(ImageHandle { index }) } diff --git a/hui/src/lib.rs b/hui/src/lib.rs index acb0965..c5dbff8 100644 --- a/hui/src/lib.rs +++ b/hui/src/lib.rs @@ -7,7 +7,7 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] -#![deny(unsafe_code)] +// #![deny(unsafe_code)] #![forbid(unsafe_op_in_unsafe_fn)] #![allow(unused_parens)] diff --git a/hui/src/text/ftm.rs b/hui/src/text/ftm.rs index 4bb9693..348c982 100644 --- a/hui/src/text/ftm.rs +++ b/hui/src/text/ftm.rs @@ -53,7 +53,9 @@ impl FontTextureManager { metrics, texture }); - self.glyph_cache.insert_unique_unchecked(key, Arc::clone(&entry)); + unsafe { + self.glyph_cache.insert_unique_unchecked(key, Arc::clone(&entry)); + } entry }