MCPcopy Create free account
hub / github.com/ahgamut/rust-ape-example / cook

Function cook

src/bin/error_option_unwrap_map.rs:31–33  ·  view source on GitHub ↗

Cooking food. Here, we showcase `map()` instead of `match` for case handling.

(chopped: Option<Chopped>)

Source from the content-addressed store, hash-verified

29
30// Cooking food. Here, we showcase `map()` instead of `match` for case handling.
31fn cook(chopped: Option<Chopped>) -> Option<Cooked> {
32 chopped.map(|Chopped(food)| Cooked(food))
33}
34
35// A function to peel, chop, and cook food all in sequence.
36// We chain multiple uses of `map()` to simplify the code.

Callers 1

part0Function · 0.85

Calls 1

CookedClass · 0.85

Tested by

no test coverage detected