Skip to content

Instantly share code, notes, and snippets.

@aletheia
Last active September 7, 2022 20:19
Show Gist options
  • Save aletheia/937225cbb0000a23ae27c34e5c831333 to your computer and use it in GitHub Desktop.
Save aletheia/937225cbb0000a23ae27c34e5c831333 to your computer and use it in GitHub Desktop.
a trait to cast User into Vec
impl From<&User> for Vec<f64> {
fn from(user: &User) -> Vec<f64> {
vec![
user.senior_citizen as f64,
user.tenure as f64,
user.monthly_charges,
user.total_charges,
// ... more fields are omitted for brevity
]
}
}
@aletheia
Copy link
Author

aletheia commented Sep 7, 2022

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment