English 中文(简体)
用于在土耳其的海关结构病媒的过滤器
原标题:implementin filter for vector of custom struct in RUST

i 象昨天新开始的一样,是新到的,而且我正在制作一个用于学习的戏剧/快乐。 i 由结构和执行界定的初始阶段。 i 坐在建立过滤病媒的功能上。 但是,在使用<代码>filter()和<编码>((> )时,就会出现错误。 i 不能确定需要做些什么,即学到更多有关序列化的内容,但可能很远。 我很想得到一些建议或解释,即问题主谋。

错误


error[E0277]: a value of type `TodoList< _>` cannot be built from an iterator over elements of type `structs::Todoitem::Todoitem< _>`
    --> src/structs/Todolist.rs:92:26
     |
92   |             .into_iter().collect()
     |                          ^^^^^^^ value of type `TodoList< _>` cannot be built from `std::iter::Iterator<Item=structs::Todoitem::Todoitem< _>>`

我的执行和指示如下。

pub struct TodoList< a> {
    pub items: Vec<Todoitem< a>>,
}

... //my implementation for filter is..
    fn helperFilterStatus(&mut self, target: Types::Status) -> TodoList< a> {
        self.items
            .into_iter().filter(|x_item| x_item.status==target).collect()
    }

以及最后的<条码>

pub struct Todoitem< a> {
    pub id: u32,
    pub title: & a str,
    ...
  }

i 没有增加我的全面执行,但是,如果需要,我可以分享优惠联系。

问题回答




相关问题
Choosing the right subclass to instantiate programmatically

Ok, the context is some serialization / deserialization code that will parse a byte stream into an object representation that s easier to work with (and vice-versa). Here s a simplified example ...

WCF Problem Sending Object To Client

Background Converting from using .Net Remoting to WCF. Most of the methods on the WCF server are working fine, but ran into one that isn t working today. This is the service contract: [...

WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

deserialize the XML Document --- Need Help

I am using the below code snippet now to deserialize the XML document ... [WebMethod] public XmlDocument OrderDocument(XmlDocument xmlDoc) { XmlSerializer serializer = new XmlSerializer(typeof(...

How do I serialize a child class?

how do I include the serialized data from a child class where both impliment iserializeable? Class A Implements ISerializable dim _B as new B Class B Implements ISerializable ...

WCF: Serialize complex objects with read-only members

Looking for some guidance on a WCF service I’m prototyping. I have a WCF service hosted in IIS that will pass data to my clients. I have a separate shared assembly that contains all my business ...

Long/multiple SQL queries vs Serialization

I m trying to improve the performance of my web app where a page does a long query to pull data from different tables on a database. It pulls invoice data with multiple item lines, invoice status, and ...

热门标签