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