Skip to content

Commit 10c38cd

Browse files
committed
chore: fix CI
1 parent 5ca565f commit 10c38cd

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

dir-structure-tools/src/image.rs

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,10 @@
2222
use std::fmt;
2323
use std::io;
2424
use std::io::Seek;
25-
#[cfg(any(
26-
feature = "image-format-png",
27-
feature = "image-format-jpeg",
28-
feature = "image-format-gif",
29-
feature = "image-format-webp",
30-
feature = "image-format-pnm",
31-
feature = "image-format-tiff",
32-
feature = "image-format-tga",
33-
feature = "image-format-bmp",
34-
feature = "image-format-ico",
35-
feature = "image-format-hdr",
36-
feature = "image-format-exr",
37-
feature = "image-format-ff",
38-
feature = "image-format-avif",
39-
feature = "image-format-qoi",
40-
))]
4125
use std::marker;
4226
use std::pin::Pin;
4327

28+
#[cfg(feature = "async")]
4429
use dir_structure::traits::async_vfs::WriteSupportingVfsAsync;
4530
#[cfg(feature = "async")]
4631
use futures::AsyncSeek;
@@ -122,7 +107,7 @@ impl<T: ImgFormat> NewtypeToInner for Img<T> {
122107
type Inner = image::DynamicImage;
123108

124109
fn into_inner(self) -> Self::Inner {
125-
self.0 .0
110+
self.0.0
126111
}
127112
}
128113

@@ -459,6 +444,8 @@ img_format!(
459444
);
460445

461446
/// A trait implemented by async vfs implementations that support reading images.
447+
#[cfg(feature = "async")]
448+
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
462449
pub trait ReadImageFromAsync<T>: VfsAsync
463450
where
464451
T: ImgFormat,
@@ -475,6 +462,8 @@ where
475462
) -> Self::ReadImageFuture<'a>;
476463
}
477464

465+
#[cfg(feature = "async")]
466+
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
478467
impl<'vfs, Vfs, T> ReadFromAsync<'vfs, Vfs> for Img<T>
479468
where
480469
Vfs: VfsAsync + ReadImageFromAsync<T> + 'vfs,
@@ -491,6 +480,8 @@ where
491480
}
492481

493482
/// A trait implemented by async vfs implementations that support writing images.
483+
#[cfg(feature = "async")]
484+
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
494485
pub trait WriteImageToAsync<'a>: WriteSupportingVfsAsync {
495486
/// The future type returned by the [`write_image_async` method](WriteImageToAsync::write_image_async).
496487
type WriteImageFuture: Future<Output = VfsResult<(), Self>> + Send + Unpin + 'a;
@@ -505,6 +496,8 @@ pub trait WriteImageToAsync<'a>: WriteSupportingVfsAsync {
505496
}
506497

507498
// impl for owned images
499+
#[cfg(feature = "async")]
500+
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
508501
impl<'a, Vfs> WriteToAsync<'a, Vfs> for DynImageWithFormat
509502
where
510503
Vfs: WriteSupportingVfsAsync + WriteImageToAsync<'a> + 'a,
@@ -522,6 +515,8 @@ where
522515
}
523516

524517
/// A trait implemented by async vfs implementations that support writing images from references.
518+
#[cfg(feature = "async")]
519+
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
525520
pub trait WriteImageToAsyncRef<'a>: WriteSupportingVfsAsync {
526521
/// The future type returned by the [`write_image_async_ref` method](WriteImageToAsyncRef::write_image_async_ref).
527522
type WriteImageRefFuture: Future<Output = VfsResult<(), Self>> + Send + Unpin + 'a;
@@ -536,6 +531,8 @@ pub trait WriteImageToAsyncRef<'a>: WriteSupportingVfsAsync {
536531
}
537532

538533
// impl for image references
534+
#[cfg(feature = "async")]
535+
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
539536
impl<'a, Vfs: 'a> WriteToAsync<'a, Vfs> for DynImageRefWithFormat<'a>
540537
where
541538
Vfs: WriteSupportingVfsAsync + WriteImageToAsyncRef<'a>,
@@ -661,13 +658,29 @@ mod tests {
661658
#[cfg(feature = "async")]
662659
use futures::AsyncSeek;
663660

661+
#[cfg(any(
662+
feature = "image-format-png",
663+
feature = "image-format-jpeg",
664+
feature = "image-format-gif",
665+
feature = "image-format-webp",
666+
feature = "image-format-pnm",
667+
feature = "image-format-tiff",
668+
feature = "image-format-tga",
669+
feature = "image-format-bmp",
670+
feature = "image-format-ico",
671+
feature = "image-format-hdr",
672+
feature = "image-format-exr",
673+
feature = "image-format-ff",
674+
feature = "image-format-avif",
675+
feature = "image-format-qoi",
676+
))]
677+
use super::Img;
664678
use dir_structure::prelude::*;
665679
#[cfg(feature = "async")]
666680
use dir_structure::traits::async_vfs::VfsAsyncWithSeekRead;
667681
#[cfg(feature = "async")]
668682
use dir_structure::traits::async_vfs::VfsAsyncWithSeekWrite;
669683
use dir_structure::traits::vfs;
670-
use super::Img;
671684

672685
fn assert_is_read_sync<'vfs, Vfs: vfs::VfsWithSeekRead<'vfs> + 'vfs, T: ReadFrom<'vfs, Vfs>>()
673686
where

0 commit comments

Comments
 (0)