我想将函数转发到另一个模块中的方法,而不重复所有类型注释,也不手动传递参数。我该怎么做?
mod other_mod;
static client: other_mod::Client = other_mod::Client::new();
async fn search = client.search; // How to do this here?
mod other_mod
:
pub struct Client();
impl Client {
pub fn new() -> Self {
Self()
}
pub async fn search(&self, query: &str) -> Result<Vec<SearchResultItem>> { ... }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)