简体   繁体   English

"由于要求冲突,无法推断函数调用中生命周期参数 '_ 的适当生命周期"

[英]cannot infer an appropriate lifetime for lifetime parameter '_ in function call due to conflicting requirements

i have a vector of a struct我有一个结构的向量

 let list = vec![
        ListenerList {
            listener: Pattern {
                cmd: "sum"
            },
            handler: |listener, connection| Box::pin(simple_handler(listener, connection))
        }
    ];

The problem is in the definition of the handler<\/code> field of ListenerList<\/code> , which has this type:问题出在ListenerList<\/code>的handler<\/code>字段的定义中,它具有以下类型:

fn(Subscription, &Connection) -> Pin<Box<dyn futures::Future<Output = ()>>>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 作为函数参数的闭包“由于需求冲突而无法推断出适当的寿命” - Closure as function parameter “cannot infer an appropriate lifetime due to conflicting requirements” 由于需求冲突,无法推断出合适的生命周期 - Cannot infer an appropriate lifetime due to conflicting requirements 匿名函数 - 由于需求冲突,无法推断出合适的生命周期 - Anonymous function - cannot infer an appropriate lifetime due to conflicting requirements 将结构转换为具有生存期的特征得到“由于需求冲突,无法为生存期参数&#39;a&#39;推断适当的生存期” - casting struct to trait with lifetime got “cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements” 递归关闭作为函数参数“由于需求冲突而无法推断出适当的寿命” - Recursive closure as function parameter “cannot infer an appropriate lifetime due to conflicting requirements” 由于对由具有 Serde Deserialize 的枚举组成的结构的要求相互冲突,因此无法为生命周期参数“de”推断合适的生命周期 - cannot infer an appropriate lifetime for lifetime parameter `'de` due to conflicting requirements for struct made of enums with Serde Deserialize 尝试实现迭代器:由于需求冲突而无法推断出适当的生存期 - Trying to implement an iterator: cannot infer an appropriate lifetime due to conflicting requirements 由于需求冲突,无法推断出自动强制的适当寿命 - cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements 由于需求冲突,无法为借用表达式推断出适当的生命周期 - cannot infer an appropriate lifetime for borrow expression due to conflicting requirements 由于递归结构中的冲突要求,无法推断出适当的生命周期 - Cannot infer an appropriate lifetime due to conflicting requirements in a recursive struct
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM