Fix doc tests imports.

This commit is contained in:
Jay
2025-08-22 16:05:49 -04:00
parent 8189268016
commit 5cf65768f6
5 changed files with 40 additions and 31 deletions
+8 -7
View File
@@ -7,7 +7,7 @@
//! Example:
//!
//! ```
//! use color::Color;
//! use colorlib::Color;
//!
//! let color = Color::from_hex("F00");
//! ```
@@ -55,7 +55,7 @@ pub enum Component {
/// # Example:
///
/// ```
/// use color::Color;
/// use colorlib::Color;
///
/// let red = Color::from_hex("F00");
/// ```
@@ -77,7 +77,7 @@ impl Color {
/// # Example:
///
/// ```
/// use color::Color;
/// use colorlib::Color;
///
/// let red = Color::from_hex("FF0000");
/// ```
@@ -94,7 +94,7 @@ impl Color {
/// # Example:
///
/// ```
/// use color::Color;
/// use colorlib::Color;
///
/// let red = Color::from_rgb(255.0, 0.0, 0.0);
/// ```
@@ -111,7 +111,7 @@ impl Color {
/// # Example:
///
/// ```
/// use color::Color;
/// use colorlib::Color;
///
/// let red = Color::from_hsv(0.0, 1.0, 1.0);
/// ```
@@ -128,7 +128,7 @@ impl Color {
/// # Example:
///
/// ```
/// use color::Color;
/// use colorlib::Color;
///
/// let red = Color::from_hcl(0.0, 1.0, 0.55);
/// ```
@@ -252,7 +252,8 @@ mod tests {
fn color_from_hcl() {
let hex_code = "4B964B";
let (hr, hg, hb) = (75u8, 150u8, 75u8);
let (r, g, b) = (75.19744022437494, 150.3948804487499, 75.19744022437494);
let (r, g, b) =
(75.19744022437494, 150.3948804487499, 75.19744022437494);
let (h1, s, v) = (120.0, 0.5, 0.5897838448970584);
let (h2, c, l) = (120.0, 0.5, 0.49);
+14 -6
View File
@@ -13,7 +13,7 @@ use wasm_bindgen::prelude::*;
/// # Example:
///
/// ```
/// use color::hcl::HCL;
/// use colorlib::hcl::HCL;
///
/// let red = HCL::new(0.0, 1.0, 0.55);
/// ```
@@ -32,7 +32,7 @@ impl HCL {
/// # Example:
///
/// ```
/// use color::hcl::HCL;
/// use colorlib::hcl::HCL;
///
/// let red = HCL::new(0.0, 1.0, 0.55);
/// ```
@@ -48,7 +48,7 @@ impl HCL {
/// # Example:
///
/// ```
/// use color::hcl::HCL;
/// use colorlib::hcl::HCL;
///
/// let red = HCL::from_hex("FF0000");
/// ```
@@ -62,7 +62,7 @@ impl HCL {
/// # Example:
///
/// ```
/// use color::hcl::HCL;
/// use colorlib::hcl::HCL;
///
/// let red = HCL::from_rgb(255.0, 0.0, 0.0);
/// ```
@@ -76,7 +76,7 @@ impl HCL {
/// # Example:
///
/// ```
/// use color::hcl::HCL;
/// use colorlib::hcl::HCL;
///
/// let red = HCL::from_hsv(0.0, 1.0, 0.55);
/// ```
@@ -185,7 +185,15 @@ mod tests {
0.864996,
0.521301
);
from_hsv!(from_hsv_dark_magenta, 300.0, 0.9, 0.5, 300.0, 0.9, 0.323601);
from_hsv!(
from_hsv_dark_magenta,
300.0,
0.9,
0.5,
300.0,
0.9,
0.323601
);
from_hsv!(
from_hsv_light_magenta,
300.0,
+8 -8
View File
@@ -13,7 +13,7 @@ use wasm_bindgen::prelude::*;
/// # Example:
///
/// ```
/// use color::hex::Hex;
/// use colorlib::hex::Hex;
///
/// let red = Hex::new(255.0, 0.0, 0.0);
/// ```
@@ -32,7 +32,7 @@ impl Hex {
/// # Example:
///
/// ```
/// use color::hex::Hex;
/// use colorlib::hex::Hex;
///
/// let red = Hex::new(255.0, 0.0, 0.0);
/// ```
@@ -46,7 +46,7 @@ impl Hex {
/// # Example:
///
/// ```
/// use color::hex::Hex;
/// use colorlib::hex::Hex;
///
/// let red = Hex::new_int(255, 0, 0);
/// ```
@@ -59,7 +59,7 @@ impl Hex {
/// # Example:
///
/// ```
/// use color::hex::Hex;
/// use colorlib::hex::Hex;
///
/// let red = Hex::from_rgb(255.0, 0.0, 0.0);
/// ```
@@ -72,7 +72,7 @@ impl Hex {
/// # Example:
///
/// ```
/// use color::hex::Hex;
/// use colorlib::hex::Hex;
///
/// let red = Hex::from_hsv(0.0, 1.0, 1.0);
/// ```
@@ -86,7 +86,7 @@ impl Hex {
/// # Example:
///
/// ```
/// use color::hex::Hex;
/// use colorlib::hex::Hex;
///
/// let red = Hex::from_hcl(0.0, 1.0, 0.55);
/// ```
@@ -100,7 +100,7 @@ impl Hex {
/// # Example:
///
/// ```
/// use color::hex::Hex;
/// use colorlib::hex::Hex;
///
/// let red = Hex::new_int(255, 0, 0);
/// assert_eq!(red.to_code(), String::from("FF0000"));
@@ -114,7 +114,7 @@ impl Hex {
/// # Example:
///
/// ```
/// use color::hex::Hex;
/// use colorlib::hex::Hex;
///
/// let red = Hex::from_code("FF0000");
/// let green = Hex::from_code("0F0");
+5 -5
View File
@@ -13,7 +13,7 @@ use wasm_bindgen::prelude::*;
/// # Example:
///
/// ```
/// use color::hsv::HSV;
/// use colorlib::hsv::HSV;
///
/// let red = HSV::new(0.0, 1.0, 1.0);
/// ```
@@ -32,7 +32,7 @@ impl HSV {
/// # Example:
///
/// ```
/// use color::hsv::HSV;
/// use colorlib::hsv::HSV;
///
/// let red = HSV::new(0.0, 1.0, 1.0);
/// ```
@@ -48,7 +48,7 @@ impl HSV {
/// # Example:
///
/// ```
/// use color::hsv::HSV;
/// use colorlib::hsv::HSV;
///
/// let red = HSV::from_hex("FF0000");
/// ```
@@ -62,7 +62,7 @@ impl HSV {
/// # Example:
///
/// ```
/// use color::hsv::HSV;
/// use colorlib::hsv::HSV;
///
/// let red = HSV::from_rgb(255.0, 0.0, 0.0);
/// ```
@@ -105,7 +105,7 @@ impl HSV {
/// # Example:
///
/// ```
/// use color::hsv::HSV;
/// use colorlib::hsv::HSV;
///
/// let red = HSV::from_hcl(0.0, 1.0, 0.55);
/// ```
+5 -5
View File
@@ -14,7 +14,7 @@ use wasm_bindgen::prelude::*;
/// # Example:
///
/// ```
/// use color::rgb::RGB;
/// use colorlib::rgb::RGB;
///
/// let red = RGB::new(255.0, 0.0, 0.0);
/// ```
@@ -33,7 +33,7 @@ impl RGB {
/// # Example:
///
/// ```
/// use color::rgb::RGB;
/// use colorlib::rgb::RGB;
///
/// let red = RGB::new(255.0, 0.0, 0.0);
/// ```
@@ -49,7 +49,7 @@ impl RGB {
/// # Example:
///
/// ```
/// use color::rgb::RGB;
/// use colorlib::rgb::RGB;
///
/// let red = RGB::from_hex("FF0000");
/// ```
@@ -64,7 +64,7 @@ impl RGB {
/// # Example:
///
/// ```
/// use color::rgb::RGB;
/// use colorlib::rgb::RGB;
///
/// let red = RGB::from_hsv(0.0, 1.0, 1.0);
/// ```
@@ -85,7 +85,7 @@ impl RGB {
/// # Example:
///
/// ```
/// use color::rgb::RGB;
/// use colorlib::rgb::RGB;
///
/// let red = RGB::from_hcl(0.0, 1.0, 0.55);
/// ```