Tidy up and fix warnings

This commit is contained in:
Joonas Javanainen 2019-06-27 22:24:15 +03:00
parent d9e5ea37e7
commit 6a6fc711b8
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179
3 changed files with 0 additions and 39 deletions

View File

@ -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};

View File

@ -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())
}
}

View File

@ -1,4 +1,3 @@
use std::mem;
use std::slice;
use crate::internal::{RawCast, RawWrapper};