Mini Parser
Medium
+3 pts
Intro to Rust
15/15
🎯 In Python, parsing a simple value might use json.loads or manual checking:
import json def parse_primitive(text): text = text.strip() if text in ("true", "false"): return text == "true" if text == "null": return None return int(text) # raises ValueError on bad input
Simple, but error handling is implicit — int() raises, json.loads raises, and callers need to know what exceptions to catch.
This exercise combines everything from the intro track: enums with data, pattern matching …
Login to see the full exercise.