Help from trait

Hi all,
I want : get data from database, send it to a mobile app in JSON.

Im using diesel to get this vec: let all: Vec<(Subscription, Event)> = ...
Then all.into() to transform it in a SubscriptionsEventResponse
i dont know how to write these things ... i am stucked here:

(Subscription, Event) i dont know how to deal this tuple, i know how to handle only one struct.. :frowning:

Subscription and Event structs already exists...

impl From<(Subscription, Event)> for SubscriptionEventResponse {
    fn from(subscription: Subscription) -> Self {
    }
}

impl From<Vec<(Subscription, Event)>> for SubscriptionsEventResponse {
    fn from(subscriptions: Vec<(Subscription, Event)>) -> Self {

    }
}

Nelson

It is unclear what you are asking. The Rust book talks about tuples here:

https://doc.rust-lang.org/book/ch03-02-data-types.html#the-tuple-type

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.