This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[derive(Debug)] | |
| struct CarRace { | |
| name: String, | |
| laps: Vec<i32>, | |
| } | |
| impl CarRace { | |
| // No receiver, a static method | |
| fn new(name: &str) -> Self { | |
| Self { name: String::from(name), laps: Vec::new() } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Mixed-encoding JSON example server | |
| // | |
| // Instructions: | |
| // | |
| // 1. Run node json_encoding_server.mjs | |
| // 2. Visit http://localhost:8080/home.html | |
| // 3. Browse the console errors | |
| import http from "http"; |
OlderNewer