replaced num::FromPrimitive in /sdl2-sys/src/video.rs with own trait FromPrimitive, then removed num dependency from sdl2-sys.

This commit is contained in:
Chris Parker
2015-12-27 17:11:50 -05:00
parent 0b9ae838a0
commit 33babac3be
3 changed files with 6 additions and 4 deletions
-1
View File
@@ -14,7 +14,6 @@ name = "sdl2_sys"
path = "src/lib.rs"
[dependencies]
num = "0.1"
libc = "0.2"
[build-dependencies.pkg-config]
-1
View File
@@ -2,7 +2,6 @@
#![cfg_attr(feature = "no_std", no_std)]
#![allow(non_camel_case_types)]
extern crate num;
extern crate libc;
#[cfg(feature = "no_std")]
extern crate core;
+6 -2
View File
@@ -4,7 +4,6 @@ use surface::SDL_Surface;
#[cfg(feature = "no_std")]
use core::prelude::*;
use libc::{c_void, c_int, c_float, c_char, uint16_t, uint32_t};
use num::FromPrimitive;
pub type SDL_bool = c_int;
@@ -95,6 +94,11 @@ pub enum SDL_GLattr {
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = 23
}
trait FromPrimitive {
fn from_i64(n: i64) -> Option<SDL_GLattr>;
fn from_u64(n: u64) -> Option<SDL_GLattr>;
}
impl FromPrimitive for SDL_GLattr {
fn from_i64(n: i64) -> Option<SDL_GLattr> {
use self::SDL_GLattr::*;
@@ -128,7 +132,7 @@ impl FromPrimitive for SDL_GLattr {
})
}
fn from_u64(n: u64) -> Option<SDL_GLattr> { FromPrimitive::from_i64(n as i64) }
fn from_u64(n: u64) -> Option<SDL_GLattr> { SDL_GLattr::from_i64(n as i64) }
}
#[derive(Copy, Clone)]