我正在尝试在外部板条箱中使用函数,它应该返回函数签名所暗示的
Result<T, E>
结构:
pub async fn market_metrics(symbols: &[String]) -> Result<Vec<market_metrics::Item>, ApiError>
我正在尝试按照 Rust 文档中的说明使用
Result<T, E>
语句解压 match
,但由于某种原因我收到此错误:
use tastyworks::market_metrics;
fn main() {
let symbols = &[String::from("AAPL")];
let m = market_metrics(symbols);
match m {
Ok(v) => v,
Err(e) => panic!(e),
}
}
error[E0308]: mismatched types
--> src/main.rs:7:9
|
7 | Ok(v) => v,
| ^^^^^ expected opaque type, found enum `std::result::Result`
|
::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tastyworks-0.13.0/src/lib.rs:79:52
|
79 | pub async fn market_metrics(symbols: &[String]) -> Result<Vec<market_metrics::Item>, ApiError> {
| ------------------------------------------- the `Output` of this `async fn`'s expected opaque type
|
= note: expected opaque type `impl std::future::Future`
found enum `std::result::Result<_, _>`
Cargo.toml 中使用此板条箱的依赖项是:
tastyworks = "0.13"