diff --git a/Cargo.toml b/Cargo.toml index abbba6ec..e0984862 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,9 @@ repository = "https://github.com/tomaka/winit" documentation = "https://docs.rs/winit" categories = ["gui"] +[package.metadata.docs.rs] +features = ["icon_loading"] + [features] icon_loading = ["image"] diff --git a/src/icon.rs b/src/icon.rs index c5106e44..bbecf2c9 100644 --- a/src/icon.rs +++ b/src/icon.rs @@ -104,12 +104,16 @@ impl Icon { #[cfg(feature = "icon_loading")] /// Loads an `Icon` from the path of an image on the filesystem. + /// + /// Requires the `icon_loading` feature. pub fn from_path>(path: P) -> image::ImageResult { image::open(path).map(Into::into) } #[cfg(feature = "icon_loading")] /// Loads an `Icon` from anything implementing `BufRead` and `Seek`. + /// + /// Requires the `icon_loading` feature. pub fn from_reader( reader: R, format: image::ImageFormat, @@ -120,12 +124,16 @@ impl Icon { #[cfg(feature = "icon_loading")] /// Loads an `Icon` from the unprocessed bytes of an image file. /// Uses heuristics to determine format. + /// + /// Requires the `icon_loading` feature. pub fn from_bytes(bytes: &[u8]) -> image::ImageResult { image::load_from_memory(bytes).map(Into::into) } #[cfg(feature = "icon_loading")] /// Loads an `Icon` from the unprocessed bytes of an image. + /// + /// Requires the `icon_loading` feature. pub fn from_bytes_with_format( bytes: &[u8], format: image::ImageFormat, @@ -135,6 +143,7 @@ impl Icon { } #[cfg(feature = "icon_loading")] +/// Requires the `icon_loading` feature. impl From for Icon { fn from(image: image::DynamicImage) -> Self { use image::{GenericImage, Pixel}; @@ -148,6 +157,7 @@ impl From for Icon { } #[cfg(feature = "icon_loading")] +/// Requires the `icon_loading` feature. impl From for Icon { fn from(buf: image::RgbaImage) -> Self { let (width, height) = buf.dimensions();