-
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
3b7d66b
commit 8cb82ce
Showing
6 changed files
with
49 additions
and
49 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
rustbook-uz/listings/ch14-more-about-cargo/listing-14-04/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" | ||
|
||
|
38 changes: 19 additions & 19 deletions
38
rustbook-uz/listings/ch14-more-about-cargo/listing-14-04/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,29 +1,29 @@ | ||
//! # Art | ||
//! # Rassom | ||
//! | ||
//! A library for modeling artistic concepts. | ||
//! Badiiy tushunchalarni modellashtirish uchun kutubxona. | ||
|
||
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 aralashtirish(c1: AsosiyRang, c2: AsosiyRang) -> IkkilamchiRang { | ||
IkkilamchiRang::Qovoqrang | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
rustbook-uz/listings/ch14-more-about-cargo/listing-14-04/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,8 +1,8 @@ | ||
use art::kinds::PrimaryColor; | ||
use art::utils::mix; | ||
use art::turlar::AsosiyRang; | ||
use rassom::yordamchi::aralashtirish; | ||
|
||
fn main() { | ||
let red = PrimaryColor::Red; | ||
let yellow = PrimaryColor::Yellow; | ||
mix(red, yellow); | ||
let qizil = AsosiyRang::Qizil; | ||
let yellow = AsosiyRang::Sariq; | ||
aralashtirish(qizil, sariq); | ||
} |
2 changes: 1 addition & 1 deletion
2
rustbook-uz/listings/ch14-more-about-cargo/listing-14-05/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-05/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
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