mirror of
https://github.com/pezkuwichain/kurdistan_blockchain-akademy.git
synced 2026-04-22 02:07:57 +00:00
@@ -258,7 +258,7 @@ pub fn answer_6() -> char {
|
||||
///
|
||||
/// fn string_to_int_in_range(s: String) -> Result<u32, OutOfRangeError> {
|
||||
/// // Given: The u32::from_str_radix function returns Result<u32, ParseIntError>
|
||||
/// let n: u32 = u32::from_str_radix(&s,10)?;
|
||||
/// let n: u32 = u32::from_str_radix(&s, 10)?;
|
||||
///
|
||||
/// match n {
|
||||
/// n if n < 5 => Err(OutOfRangeError::TooSmall),
|
||||
|
||||
+4
-1
@@ -25,7 +25,7 @@ macro_rules! map {
|
||||
/// generate this implementation for us, as such:
|
||||
///
|
||||
/// ```
|
||||
/// use pba_qualifier_exam:impl_get;
|
||||
/// use pba_qualifier_exam::impl_get;
|
||||
/// impl_get! {
|
||||
/// // implements `Get<u32>` for `struct Six`
|
||||
/// Six: u32 = 6;
|
||||
@@ -89,6 +89,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn impl_get() {
|
||||
use super::Get;
|
||||
|
||||
impl_get!(
|
||||
// should generate `struct Foo` that implements `Get<u32>`
|
||||
Foo: u32 = 10;
|
||||
@@ -102,6 +104,7 @@ mod tests {
|
||||
// assert_eq!(Foo::get(), 10);
|
||||
// assert_eq!(Bar::get(), 42);
|
||||
// assert_eq!(Baz::get(), 21);
|
||||
assert_eq!(true, false, "Make sure to remove this line and uncomment the tests above");
|
||||
|
||||
// As an extra, ungraded, challenge, try to make this work.
|
||||
// This is not part of the main problem because it requires the nightly compiler.
|
||||
|
||||
Reference in New Issue
Block a user