From 022a174dc677d62630af24267d6579240a545be1 Mon Sep 17 00:00:00 2001 From: ripytide Date: Thu, 30 May 2024 19:22:28 +0100 Subject: [PATCH] fix doc-tests --- src/compose.rs | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/compose.rs b/src/compose.rs index 1a6683fc..932c413c 100644 --- a/src/compose.rs +++ b/src/compose.rs @@ -15,6 +15,8 @@ use crate::definitions::Image; /// # Examples /// ``` /// use imageproc::compose::crop; +/// use imageproc::rect::Rect; +/// use imageproc::gray_image; /// /// let image = gray_image!( /// 0, 0, 0, 0, 0, 0; @@ -22,17 +24,14 @@ use crate::definitions::Image; /// 0, 0, 0, 1, 1, 0; /// 0, 0, 0, 1, 1, 0; /// 0, 0, 0, 0, 0, 0; -/// 0, 0, 0, 0, 0, 0; -/// ); +/// 0, 0, 0, 0, 0, 0); /// -/// let cropped = crop(image, Rect {x, 3, y: 1, width: 2, height: 3}); +/// let cropped = crop(&image, Rect {x: 3, y: 1, width: 2, height: 3}); /// /// assert_eq!(cropped, gray_image!( /// 1, 1; /// 1, 1; -/// 1, 1; -/// 1, 1; -/// )); +/// 1, 1)); /// ``` pub fn crop

(image: &Image

, rect: Rect) -> Image

where @@ -63,7 +62,8 @@ where /// /// # Examples /// ``` -/// use imageproc::compose::crop; +/// use imageproc::compose::flip_horizontal; +/// use imageproc::gray_image; /// /// let image = gray_image!( /// 1, 2, 3, 4, 5, 6; @@ -71,10 +71,9 @@ where /// 1, 2, 3, 4, 5, 6; /// 1, 2, 3, 4, 5, 6; /// 1, 2, 3, 4, 5, 6; -/// 1, 2, 3, 4, 5, 6; -/// ); +/// 1, 2, 3, 4, 5, 6); /// -/// let flipped = flip_horizontal(image); +/// let flipped = flip_horizontal(&image); /// /// assert_eq!(flipped, gray_image!( /// 6, 5, 4, 3, 2, 1; @@ -82,8 +81,7 @@ where /// 6, 5, 4, 3, 2, 1; /// 6, 5, 4, 3, 2, 1; /// 6, 5, 4, 3, 2, 1; -/// 6, 5, 4, 3, 2, 1; -/// )); +/// 6, 5, 4, 3, 2, 1)); /// ``` pub fn flip_horizontal

(image: &Image

) -> Image

where @@ -115,7 +113,8 @@ where /// /// # Examples /// ``` -/// use imageproc::compose::crop; +/// use imageproc::compose::flip_vertical; +/// use imageproc::gray_image; /// /// let image = gray_image!( /// 1, 1, 1, 1, 1, 1; @@ -123,10 +122,9 @@ where /// 3, 3, 3, 3, 3, 3; /// 4, 4, 4, 4, 4, 4; /// 5, 5, 5, 5, 5, 5; -/// 6, 6, 6, 6, 6, 6; -/// ); +/// 6, 6, 6, 6, 6, 6); /// -/// let flipped = flip_horizontal(image); +/// let flipped = flip_vertical(&image); /// /// assert_eq!(flipped, gray_image!( /// 6, 6, 6, 6, 6, 6; @@ -134,8 +132,7 @@ where /// 4, 4, 4, 4, 4, 4; /// 3, 3, 3, 3, 3, 3; /// 2, 2, 2, 2, 2, 2; -/// 1, 1, 1, 1, 1, 1; -/// )); +/// 1, 1, 1, 1, 1, 1)); /// ``` pub fn flip_vertical

(image: &Image

) -> Image

where