Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
ismoilovdevml committed Nov 24, 2023
1 parent 3b7d66b commit 8cb82ce
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 49 deletions.
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"

Expand Down
38 changes: 19 additions & 19 deletions rustbook-uz/listings/ch14-more-about-cargo/listing-14-04/src/lib.rs
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
}
}
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);
}
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"

Expand Down
44 changes: 22 additions & 22 deletions rustbook-uz/listings/ch14-more-about-cargo/listing-14-05/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
// ANCHOR: here
//! # 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::aralashtirish;

pub mod kinds {
pub mod turlar {
// --snip--
// ANCHOR_END: here
/// The primary colors according to the RYB color model.
pub enum PrimaryColor {
Red,
Yellow,
Blue,
/// 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,
}
// ANCHOR: here
}

pub mod utils {
pub mod yordamchi {
// --snip--
// ANCHOR_END: here
use crate::kinds::*;
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
}
// ANCHOR: here
}
Expand Down
2 changes: 1 addition & 1 deletion rustbook-uz/src/ch14-00-more-about-cargo.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Hozirgacha biz kodimizni yaratish(build), ishga tushirish(run) va sinab ko'rish(
* [crates.io](https://crates.io/)<!-- ignore --> dan binary(ikkilik) fayllarni o'rnating
* Maxsus buyruqlar yordamida cargoni kengaytiring

Caergo biz ushbu bobda ko'rib chiqiladigan funksiyalardan ham ko'proq narsani qila oladi, shuning uchun uning barcha xususiyatlarini to'liq tushuntirish uchun uning [texnik hujjatlariga](https://doc.rust-lang.org/cargo/) qarang.
Cargo biz ushbu bobda ko'rib chiqiladigan funksiyalardan ham ko'proq narsani qila oladi, shuning uchun uning barcha xususiyatlarini to'liq tushuntirish uchun uning [texnik hujjatlariga](https://doc.rust-lang.org/cargo/) qarang.

0 comments on commit 8cb82ce

Please sign in to comment.