mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 21:48:36 +00:00
Tidy up and fix warnings
This commit is contained in:
parent
d9e5ea37e7
commit
6a6fc711b8
@ -1,9 +1,7 @@
|
||||
use parking_lot::ReentrantMutex;
|
||||
use std::cell::RefCell;
|
||||
use std::ffi::CStr;
|
||||
use std::ops::Drop;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::io::Io;
|
||||
use crate::string::{ImStr, ImString};
|
||||
|
||||
36
src/image.rs
36
src/image.rs
@ -1,4 +1,3 @@
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::os::raw::c_void;
|
||||
|
||||
@ -185,38 +184,3 @@ impl<'ui> ImageButton<'ui> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Generic texture mapping for use by renderers.
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Textures<T> {
|
||||
textures: HashMap<usize, T>,
|
||||
next: usize,
|
||||
}
|
||||
|
||||
impl<T> Textures<T> {
|
||||
pub fn new() -> Self {
|
||||
Textures {
|
||||
textures: HashMap::new(),
|
||||
next: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, texture: T) -> TextureId {
|
||||
let id = self.next;
|
||||
self.textures.insert(id, texture);
|
||||
self.next += 1;
|
||||
TextureId::from(id)
|
||||
}
|
||||
|
||||
pub fn replace(&mut self, id: TextureId, texture: T) -> Option<T> {
|
||||
self.textures.insert(id.id(), texture)
|
||||
}
|
||||
|
||||
pub fn remove(&mut self, id: TextureId) -> Option<T> {
|
||||
self.textures.remove(&id.id())
|
||||
}
|
||||
|
||||
pub fn get(&self, id: TextureId) -> Option<&T> {
|
||||
self.textures.get(&id.id())
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
use std::mem;
|
||||
use std::slice;
|
||||
|
||||
use crate::internal::{RawCast, RawWrapper};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user