Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rust 如何将汇从0.1期货转换为0.3期货_Rust - Fatal编程技术网

Rust 如何将汇从0.1期货转换为0.3期货

Rust 如何将汇从0.1期货转换为0.3期货,rust,Rust,我正在将我的代码库从futures 0.1更新为futures 0.3。我以前使用的函数如下所示: fn sink_task( message: String, sink: Box< Sink< SinkItem = datum::Message, SinkError = tungstenite::error::Error, >,

我正在将我的代码库从futures 0.1更新为futures 0.3。我以前使用的函数如下所示:

fn sink_task(
        message: String,
        sink: Box<
            Sink<
                SinkItem = datum::Message,
                SinkError = tungstenite::error::Error,
            >,
        >,
    ) 
fn接收器任务(
消息:String,
水槽:盒子<
下沉<
SinkItem=datum::Message,
SinkError=tungstenite::error::error,
>,
>,
) 
我试图使其符合新的0.3定义

pub trait Sink<Item> {
    type Error;
}
pub-trait-Sink{
类型错误;
}
像这样:

fn sink_task(
        message: String,
        sink: Box<
            Sink<
                Item = datum::Message,
                Error = tungstenite::error::Error,
            >,
        >,
    ) 
fn接收器任务(
消息:String,
水槽:盒子<
下沉<
Item=datum::Message,
Error=tungstenite::Error::Error,
>,
>,
) 

但是,如果参数数量错误,则会出现错误,应为一个。我假设这意味着要删除Error参数,但我仍然得到一个错误,表示Error丢失。

Item参数是0.3中的通用参数,而不是关联类型。因此正确的语法是
Sink