我正在使用 fltk-rs 的包,但遇到了“多适用项处于作用域内”错误。
fltk = "0.10.14"
use fltk::{table::*};
pub struct AssetViewer {
pub table: Table,
}
impl AssetViewer {
pub fn new(x: i32, y: i32, width: i32, height: i32) -> Self {
let mut av = AssetViewer {
table: Table::new(x,y,width-50,height,""),
};
av.table.set_rows(5);
av.table.set_cols(5);
av
}
pub fn load_file_images(&mut self, asset_paths: Vec<String>){
self.table.clear(); //<- throws multiple applicable items in scope
}
}
出现错误:
error[E0034]: multiple applicable items in scope
--> src\main.rs:18:20
|
18 | self.table.clear(); //<- throws multiple applicable items in scope
| ^^^^^ multiple `clear` found
|
= note: candidate #1 is defined in an impl of the trait `fltk::TableExt` for the type `fltk::table::Table`
= note: candidate #2 is defined in an impl of the trait `fltk::GroupExt` for the type `fltk::table::Table`
我想要指定我正在引用TableExt
特性,而不是GroupExt
特性。我应该怎么做?
fltk::GroupExt::clear(self.table)
- Ivan C