-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/rust-lang-uz/book
- Loading branch information
Showing
22 changed files
with
752 additions
and
674 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
rustbook-en/listings/ch09-error-handling/listing-09-13/src/lib.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
pub struct Guess { | ||
value: i32, | ||
} | ||
|
||
impl Guess { | ||
pub fn new(value: i32) -> Guess { | ||
if value < 1 || value > 100 { | ||
panic!("Guess value must be between 1 and 100, got {value}."); | ||
} | ||
|
||
Guess { value } | ||
} | ||
|
||
pub fn value(&self) -> i32 { | ||
self.value | ||
} | ||
} |
21 changes: 1 addition & 20 deletions
21
rustbook-en/listings/ch09-error-handling/listing-09-13/src/main.rs
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.