当我试图编译代码时,我得到了
error[E0046]: not all trait items implemented, missing: `from`
--> src/api/error.rs:25:1
|
25 | impl From<UserError> for warp::reply::Json {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from` in implementation
|
= help: implement the missing item: `fn from(_: T) -> Self { todo!() }`
我的代码很简单,
impl From<UserError> for warp::reply::Json { todo!() }
这里的问题是,您需要编写或存根要编译的From
特性的实现,即当前的
pub trait From<T> {
pub fn from(T) -> Self;
}
看起来,
impl From<UserError> for warp::reply::Json {
fn from(err: UserError) -> Self {
todo!()
}
}