Skip to content

Commit

Permalink
fix doc-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ripytide committed May 30, 2024
1 parent 7b72c34 commit 022a174
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,23 @@ 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;
/// 0, 0, 0, 1, 1, 0;
/// 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<P>(image: &Image<P>, rect: Rect) -> Image<P>
where
Expand Down Expand Up @@ -63,27 +62,26 @@ 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;
/// 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;
/// );
/// 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;
/// 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;
/// ));
/// 6, 5, 4, 3, 2, 1));
/// ```
pub fn flip_horizontal<P>(image: &Image<P>) -> Image<P>
where
Expand Down Expand Up @@ -115,27 +113,26 @@ 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;
/// 2, 2, 2, 2, 2, 2;
/// 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;
/// 5, 5, 5, 5, 5, 5;
/// 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<P>(image: &Image<P>) -> Image<P>
where
Expand Down

0 comments on commit 022a174

Please sign in to comment.