-
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.
- Loading branch information
1 parent
8cb82ce
commit d73b4ec
Showing
6 changed files
with
40 additions
and
54 deletions.
There are no files selected for viewing
5 changes: 3 additions & 2 deletions
5
rustbook-uz/listings/ch14-more-about-cargo/listing-14-05/Cargo.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
rustbook-uz/listings/ch14-more-about-cargo/listing-14-06/Cargo.toml
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "art" | ||
name = "rassom" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
44 changes: 22 additions & 22 deletions
44
rustbook-uz/listings/ch14-more-about-cargo/listing-14-06/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 |
---|---|---|
@@ -1,33 +1,33 @@ | ||
//! # Art | ||
//! # Rassom | ||
//! | ||
//! A library for modeling artistic concepts. | ||
//! Badiiy tushunchalarni modellashtirish uchun kutubxona. | ||
|
||
pub use self::kinds::PrimaryColor; | ||
pub use self::kinds::SecondaryColor; | ||
pub use self::utils::mix; | ||
pub use self::turlar::AsosiyRang; | ||
pub use self::turlar::IkkilamchiRang; | ||
pub use self::yordamchi::yordamchi; | ||
|
||
pub mod kinds { | ||
/// The primary colors according to the RYB color model. | ||
pub enum PrimaryColor { | ||
Red, | ||
Yellow, | ||
Blue, | ||
pub mod turlar { | ||
/// RYB rang modeliga muvofiq asosiy ranglar. | ||
pub enum AsosiyRang { | ||
Qizil, | ||
Sariq, | ||
Kok, | ||
} | ||
|
||
/// The secondary colors according to the RYB color model. | ||
pub enum SecondaryColor { | ||
Orange, | ||
Green, | ||
Purple, | ||
/// RYB rang modeliga muvofiq ikkinchi darajali ranglar. | ||
pub enum IkkilamchiRang { | ||
Qovoqrang, | ||
Yashil, | ||
Siyohrang, | ||
} | ||
} | ||
|
||
pub mod utils { | ||
use crate::kinds::*; | ||
pub mod yordamchi { | ||
use crate::turlar::*; | ||
|
||
/// Combines two primary colors in equal amounts to create | ||
/// a secondary color. | ||
pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor { | ||
SecondaryColor::Orange | ||
/// Ikkilamchi rang yaratish uchun ikkita asosiy rangni teng | ||
/// miqdorda birlashtiradi. | ||
pub fn yordamchi(c1: AsosiyRang, c2: AsosiyRang) -> IkkilamchiRang { | ||
IkkilamchiRang::Qovoqrang | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
rustbook-uz/listings/ch14-more-about-cargo/listing-14-06/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
// ANCHOR: here | ||
use art::mix; | ||
use art::PrimaryColor; | ||
use rassom::aralashtirish; | ||
use rassom::AsosiyRang; | ||
|
||
fn main() { | ||
// --snip-- | ||
// ANCHOR_END: here | ||
let red = PrimaryColor::Red; | ||
let yellow = PrimaryColor::Yellow; | ||
mix(red, yellow); | ||
let qizil = AsosiyRang::qizil; | ||
let sariq = AsosiyRang::Sariq; | ||
mix(qizil, sariq); | ||
// ANCHOR: here | ||
} | ||
// ANCHOR_END: here |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.