The orbclient::Color returned by Image::data() isn't really the same as orbclient's Color?
Created by: ca1ek
I got this really weird issue, where the compiler, what I think means: orbimage's orbclient::Color isn't the same thing as orbclient's orbclient::Color,
Here's my code and the error
/*
src/texture/mod.rs:8:5: 8:35 error: mismatched types [E0308]
src/texture/mod.rs:8 data[(x + y * width) as usize]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/texture/mod.rs:8:5: 8:35 help: run `rustc --explain E0308` to see a detailed explanation
src/texture/mod.rs:8:5: 8:35 note: expected type `orbclient::Color`
src/texture/mod.rs:8:5: 8:35 note: found type `orbclient::color::Color`
*/
fn get_by_coord(texture: &orbimage::Image, x: u32, y: u32) -> orbclient::color::Color {
let data = texture.data();
let width = texture.width();
data[(x + y * width) as usize]
}
However, when I turn the returned value to orbclient::Color, like this
fn get_by_coord(texture: &orbimage::Image, x: u32, y: u32) -> orbclient::Color {
let data = texture.data();
let width = texture.width();
data[(x + y * width) as usize]
}
I still get the same error. Is it the compiler confusing something?
In my Cargo.lock, orbimage depends on the version of orbclient that I'm using,
[[package]]
name = "orbclient"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"sdl2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "orbimage"
version = "0.1.0"
source = "git+https://github.com/redox-os/orbimage.git#bbe01ece496f9d67681d07541554a874ed3791d4"
dependencies = [
"orbclient 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.1.0 (git+https://github.com/servo/rust-png.git)",
]
In Cargo.toml I have this:
[dependencies]
orbclient = { git = "https://github.com/redox-os/orbclient" }
orbimage = { git = "https://github.com/redox-os/orbimage.git" }