Skip to content

Commit

Permalink
Update to use AsRef.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Mar 26, 2015
1 parent 6dc56e0 commit 74108c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/image.rs
Expand Up @@ -11,8 +11,9 @@ use stb_image::bindgen::*;

use libc;
use libc::{c_void, c_int};
use std::convert::AsRef;
use std::ffi::{AsOsStr, CString};
use std::path::AsPath;
use std::path::Path;

pub struct Image<T> {
pub width : usize,
Expand All @@ -36,7 +37,7 @@ pub enum LoadResult {
ImageF32(Image<f32>),
}

pub fn load<T: AsPath+AsOsStr>(path: T) -> LoadResult {
pub fn load<T: AsRef<Path>+AsOsStr>(path: T) -> LoadResult {
let force_depth = 0;
load_with_depth(path, force_depth, false)
}
Expand All @@ -56,7 +57,7 @@ fn load_internal<T: Clone>(buf: *mut T, w: c_int, h: c_int, d: c_int) -> Image<T
}
}

pub fn load_with_depth<T: AsOsStr+AsPath>(path: T, force_depth: usize, convert_hdr: bool) -> LoadResult {
pub fn load_with_depth<T: AsOsStr+AsRef<Path>>(path: T, force_depth: usize, convert_hdr: bool) -> LoadResult {
let mut width = 0 as c_int;
let mut height = 0 as c_int;
let mut depth = 0 as c_int;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -10,7 +10,7 @@
#![crate_name = "stb_image"]
#![crate_type = "rlib"]

#![feature(collections, std_misc, libc, old_io)]
#![feature(collections, convert, std_misc, libc)]

extern crate libc;

Expand Down

1 comment on commit 74108c8

@metajack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.