【发布时间】:2020-12-20 11:20:01
【问题描述】:
我正在使用 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)
标签: rust