MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / make_person

Function make_person

0b_traits/rust/supertraits.rs:95–102  ·  view source on GitHub ↗
(rnd: u8)

Source from the content-addressed store, hash-verified

93}
94
95fn make_person(rnd: u8) -> Box<dyn Person> {
96 match rnd {
97 0..=3 => Box::new(StreetPerson("Bob".to_string())),
98 4..=6 => Box::new(CollegeStudent("Bobby".to_string())),
99 7..=9 => Box::new(RustProgrammer("Robert".to_string())),
100 _ => Box::new(SuperCompSciStudent("Bert".to_string())),
101 }
102}
103
104fn main() {
105 let p = make_person(8);

Callers 1

mainFunction · 0.70

Calls 4

StreetPersonClass · 0.85
CollegeStudentClass · 0.70
RustProgrammerClass · 0.70
SuperCompSciStudentClass · 0.70

Tested by

no test coverage detected