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

Method neighbor

29_pattern_matching_revisited/rust/pattern/src/main.rs:20–39  ·  view source on GitHub ↗
(self, direction: &str)

Source from the content-addressed store, hash-verified

18 }
19
20 fn neighbor(self, direction: &str) -> Self {
21 match direction {
22 "left" => {
23 println!("changed to room {}", direction);
24 Room::new(vec!["knife", "bread", "butter"].into_iter())
25 }
26 "north" => {
27 println!("changed to room {}", direction);
28 Room::new(&mut ["polar-bear", "ice", "snow"].into_iter())
29 }
30 "right" | "front" | "back" => {
31 println!("No room to the {}", direction);
32 self
33 }
34 _ => {
35 println!("unknown direction {}", direction);
36 self
37 }
38 }
39 }
40}
41
42struct Character {

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected