Replies: 1 comment
-
Can't you just: let classes: Vec<Class> = record.into_iter().map(|record| Class {
semester: match record.semester.unwrap().as_ref() {
"First" => Semester::First,
"Second" => Semester::Second,
_ => panic!("Unexpected semester value"),
},
..record
}).collect(); ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have this code piece that maps a record to a Class, since Semester is a custom type and sqlx doesn't seem to be able to map the values as expected, how would I refactor this since the Record type doesn't exist?
Beta Was this translation helpful? Give feedback.
All reactions