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>>) {
    print!("Worked");
}

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(
        Texture::from_path(
            &mut texture_context,
            assets.join("BlackRook.png"), 
            Flip::None,
            &TextureSettings::new(),
        ) Result<Texture<Resources>, ...>
        .unwrap(),
    );

    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/main.rs:16:38
   |
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

<Resources>

How do I do this?

squint

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:

Sprite:
piston2d_sprite::sprite::Sprite

Texture:
piston_gfx_texture::Texture

Resources:
gfx_device_gl::Resources

....so 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.