Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled docs.rs feature gate flag rendering. #304

Merged
merged 2 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually had this before, but it got dropped in #281 (which should probably be reverted at some point).

1 change: 1 addition & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![crate_name = "gdal"]
#![crate_type = "lib"]
// Enable `doc_cfg` features when `docsrs` is defined by docs.rs config
#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc = include_str!("../README.md")]

//! ## Examples
Expand Down
1 change: 1 addition & 0 deletions src/raster/mdarray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,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