mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-06 18:59:19 +00:00
Refactor is_international and get_fees methods in Package struct
This commit is contained in:
parent
aea00abd1c
commit
b480c57095
@ -7,7 +7,7 @@
|
|||||||
// Execute `rustlings hint structs3` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint structs3` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
// NOTE 結構體關聯函式與方法
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Package {
|
struct Package {
|
||||||
@ -31,12 +31,14 @@ impl Package {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_international(&self) -> ??? {
|
fn is_international(&self) -> bool {
|
||||||
// Something goes here...
|
// Something goes here...
|
||||||
|
if self.sender_country == self.recipient_country { false } else { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_fees(&self, cents_per_gram: u32) -> ??? {
|
fn get_fees(&self, cents_per_gram: u32) -> u32 {
|
||||||
// Something goes here...
|
// Something goes here...
|
||||||
|
self.weight_in_grams * cents_per_gram
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user