我有这个来源:
pub fn draw<G, C>(&self, font: &mut C, draw_state: &DrawState, transform: Matrix2d, g: &mut G)
where
C: CharacterCache,
G: Graphics<Texture = <C as CharacterCache>::Texture>,
{
self.properties.draw(
self.text.as_str(),
&mut font,
&draw_state,
transform,
g,
);
}
Run Code Online (Sandbox Code Playgroud)
而错误
the trait bound `&mut C: graphics::character::CharacterCache` is not satisfied
(the trait `graphics::character::CharacterCache` is not implemented for `&mut C`)
Run Code Online (Sandbox Code Playgroud)
C定义的唯一方面是它实现CharacterCache,但错误说明相反.
DrawState,Matrix2d,CharacterCache和其实施方式中,Texture和self.properties( Text)由活塞2D图形库提供.总的来说,一定有关于特征的东西我误解了.
该Text::draw函数签名:
fn draw<C, G>(
&self,
text: &str,
cache: &mut C,
draw_state: …Run Code Online (Sandbox Code Playgroud)