mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-03 17:29:18 +00:00
4 extra exos
This commit is contained in:
parent
bc75421cda
commit
9a66482902
@ -7,7 +7,7 @@
|
||||
// Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand
|
||||
// for a hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
#[test]
|
||||
fn main() {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand
|
||||
// for a hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
let data = "Rust is great!".to_string();
|
||||
|
||||
@ -31,11 +31,11 @@ impl Package {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_international(&self) -> ??? {
|
||||
fn is_international(&self) -> u32 {
|
||||
// Something goes here...
|
||||
}
|
||||
|
||||
fn get_fees(&self, cents_per_gram: u32) -> ??? {
|
||||
fn get_fees(&self, cents_per_gram: u32) -> u32 {
|
||||
// Something goes here...
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,10 +5,13 @@
|
||||
// Execute `rustlings hint enums3` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
enum Message {
|
||||
// TODO: implement the message variant types based on their usage below
|
||||
ChangeColor(i32, i32, i32),
|
||||
Echo(String),
|
||||
Move(Point),
|
||||
Quit,
|
||||
}
|
||||
|
||||
struct Point {
|
||||
@ -54,10 +57,10 @@ mod tests {
|
||||
#[test]
|
||||
fn test_match_message_call() {
|
||||
let mut state = State {
|
||||
quit: false,
|
||||
position: Point { x: 0, y: 0 },
|
||||
color: (0, 0, 0),
|
||||
message: "hello world".to_string(),
|
||||
quit: true,
|
||||
position: Point { x: 10, y: 15 },
|
||||
color: (255, 0, 255),
|
||||
message: "Hello world!".to_string(),
|
||||
};
|
||||
state.process(Message::ChangeColor(255, 0, 255));
|
||||
state.process(Message::Echo(String::from("Hello world!")));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user