泛型结构构造函数中的“预期类型参数”错误
struct TextureFactory<R> where R: gfx::Resources { block_textures: Vec<Rc<Texture<R>>>,}impl<R> TextureFactory<R> where R: gfx::Resources { fn new(window: PistonWindow) -> Self { let texture = Rc::new(gfx_texture::Texture::from_path( &mut *window.factory.borrow_mut(), "assets/element_red_square.png", Flip::None, &TextureSettings::new() ).unwrap()); let block_textures = Vec::new(); block_textures.push(texture); TextureFactory { block_textures: block_textures, } }}
src/main.rs:37:9: 39:10 error: mismatched types: expected `TextureFactory<R>`, found `TextureFactory<gfx_device_gl::Resources>` (expected type parameter, found enum `gfx_device_gl::Resources`)
gfx_device_gl::Resources
gfx::Resources
白板的微信