Skip to content

Commit

Permalink
Enabled docs.rs feature gate flag rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
metasim committed Sep 2, 2022
1 parent 604c41f commit 3f7698d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ trybuild = "1.0"

[workspace]
members = ["gdal-sys"]

# docs.rs-specific configuration
[package.metadata.docs.rs]
# include `array` feature in documentation
features = ["array"]
# define attribute `docsrs` for feature badges
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub enum GdalError {
#[error("StrUtf8Error")]
StrUtf8Error(#[from] std::str::Utf8Error),
#[cfg(feature = "ndarray")]
#[cfg_attr(docsrs, doc(cfg(feature = "array")))]
#[error("NdarrayShapeError")]
NdarrayShapeError(#[from] ndarray::ShapeError),
#[error("CPL error class: '{class:?}', error number: '{number}', error msg: '{msg}'")]
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#![crate_name = "gdal"]
#![crate_type = "lib"]

// Enable `doc_cfg` features when `docsrs` is defined by docs.rs config
#![cfg_attr(docsrs, feature(doc_cfg))]

pub use version::version_info;

pub mod config;
Expand Down
1 change: 1 addition & 0 deletions src/raster/mdarray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ impl<'a> MDArray<'a> {
}

#[cfg(feature = "ndarray")]
#[cfg_attr(docsrs, doc(cfg(feature = "array")))]
/// Read a 'Array2<T>' from this band. T implements 'GdalType'.
///
/// # Arguments
Expand Down
2 changes: 2 additions & 0 deletions src/raster/rasterband.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ impl<'a> RasterBand<'a> {
}

#[cfg(feature = "ndarray")]
#[cfg_attr(docsrs, doc(cfg(feature = "array")))]
/// Read a 'Array2<T>' from this band. T implements 'GdalType'.
///
/// # Arguments
Expand Down Expand Up @@ -348,6 +349,7 @@ impl<'a> RasterBand<'a> {
}

#[cfg(feature = "ndarray")]
#[cfg_attr(docsrs, doc(cfg(feature = "array")))]
/// Read a 'Array2<T>' from a 'Dataset' block. T implements 'GdalType'
/// # Arguments
/// * block_index - the block index
Expand Down

0 comments on commit 3f7698d

Please sign in to comment.