|
6 | 6 | use image::{GenericImageView as _, RgbImage};
|
7 | 7 | use nv_flip::{FlipImageRgb8, DEFAULT_PIXELS_PER_DEGREE};
|
8 | 8 |
|
| 9 | +#[cfg(docsrs)] |
| 10 | +#[doc(hidden)] |
| 11 | +#[macro_export] |
| 12 | +macro_rules! include_screenshot { |
| 13 | + ($path:literal $(, $caption:literal)? $(,)?) => { |
| 14 | + concat!( |
| 15 | + "![", $($caption,)? "]", |
| 16 | + "(", "https://raw.githubusercontent.com/linebender/xilem/", |
| 17 | + "masonry-v", env!("CARGO_PKG_VERSION"), "/masonry/src/", $path, |
| 18 | + ")", |
| 19 | + ) |
| 20 | + }; |
| 21 | +} |
| 22 | + |
| 23 | +#[cfg(not(docsrs))] |
| 24 | +#[doc(hidden)] |
| 25 | +#[macro_export] |
| 26 | +/// Macro used to create markdown img tag, with a different URL when uploading to docs.rs. |
| 27 | +macro_rules! include_screenshot { |
| 28 | + ($path:literal $(, $caption:literal)? $(,)?) => { |
| 29 | + concat!( |
| 30 | + "![", $($caption,)? "]", |
| 31 | + "(", env!("CARGO_MANIFEST_DIR"), "/src/", $path, ")", |
| 32 | + ) |
| 33 | + }; |
| 34 | +} |
| 35 | + |
| 36 | +// [!Image alt](link) |
| 37 | + |
| 38 | +// https://raw.githubusercontent.com/linebender/xilem/7f40266bd831c3f8e715bf7af325e3a53e046612/masonry/src/widget/screenshots/masonry__widget__align__tests__centered.png |
| 39 | + |
| 40 | +#[cfg(FALSE)] |
| 41 | +include_screenshot!("hello"); |
| 42 | + |
| 43 | +#[cfg_attr(docsrs, doc = r" This is a doc comment.")] |
| 44 | +#[cfg_attr(not(docsrs), doc = r" This is a doc comment.")] |
9 | 45 | pub(crate) fn get_image_diff(ref_image: &RgbImage, new_image: &RgbImage) -> Option<RgbImage> {
|
10 | 46 | assert_eq!(
|
11 | 47 | (ref_image.width(), ref_image.height()),
|
|
0 commit comments