Need advice on passing variable to function

After compiling the following code:

use std::rc::Rc;
use piston_window::*;
use sprite::*;

fn tester(chesspiece: Sprite<Texture<Resources>>) {

fn main() {
    let mut texture_context: TextureContext<Factory, ..., ...> = TextureContext {
        factory: window.factory.clone(),
        encoder: window.factory.create_command_buffer().into(),

    let br_tex: Rc<Texture<Resources>> = Rc::new(
            &mut texture_context,
        ) Result<Texture<Resources>, ...>

    let mut br_sprite: Sprite<Texture<Resources>> = Sprite::from_texture(texture: br_tex.clone());

I get the following error:

error[E0412]: cannot find type `Resources` in this scope
  --> src/
16 | fn tester(chesspiece: Sprite<Texture<Resources>>) {
   |          -                           ^^^^^^^^^ not found in this scope
   |          |
   |          help: you might be missing a type parameter: `<Resources>`

...which is great info, but I don't see how to supply


How do I do this?


I suggest that you search the crate that contains sprite for the types Texture and Resources. Does that mod have a use texture::*; or similar path indicator?

@ TomP THANK YOU SO MUCH!! Your suggestion was an eye-opener.
It turns out all I had to do (in VSCode IDE) was hover the mouse over the "Resources" portion of:

let mut generic_sprite: Sprite<Texture<Resources>> = &mut br_sprite;

to get the crate ID's of each type element which showed:



gfx_device_gl::Resources I entered the gfx_device_gl crate in the Cargo.toml file and all was fixed!

This forum has proven a great place to get Rust help.

Thank you !

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.