Responses for exercises in Exercism.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
684 B

// This stub file contains items which aren't used yet; feel free to remove this module attribute
// to enable stricter warnings.
#![allow(unused)]
pub struct User {
name: String,
age: u32,
weight: f32,
}
impl User {
pub fn new(name: String, age: u32, weight: f32) -> Self {
Self { name, age, weight }
}
pub fn name(&self) -> &str {
&self.name
}
pub fn age(&self) -> u32 {
self.age
}
pub fn weight(&self) -> f32 {
self.weight
}
pub fn set_age(&mut self, new_age: u32) {
self.age = new_age;
}
pub fn set_weight(&mut self, new_weight: f32) {
self.weight = new_weight
}
}