Crates.io | bobo |
lib.rs | bobo |
version | 0.1.1 |
source | src |
created_at | 2024-09-21 13:15:34.556103 |
updated_at | 2024-09-21 13:19:46.748188 |
description | an elegant and powerful rust development tool library |
homepage | https://github.com/moluopro |
repository | https://github.com/moluopro |
max_upload_size | |
id | 1382210 |
size | 2,100 |
an elegant and powerful rust development tool library
use bobo::oop::*;
class! {
Person {
name: String
age: u32
fn greet(){
println!("{}", format!("Hello, my name is {}.", self.name));
}
fn get_age(years: u32) -> u32 {
self.age + years
}
}
}
fn main() {
let person = Person {
name: String::from("Tom"),
age: 30,
};
person.greet();
println!("I am {} years old.", person.get_age(5));
}