From 3cbc6f23c37f1c20d9a73b36c0b59a79d556897b Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:01:32 +1200 Subject: [PATCH] :memo: Document how to set output dtype using turbofish operator Show how the turbofish operator (e.g. `::`) can be used to set the output dtype from the `read_geotiff` function. Mention all supported dtypes in crate-level docs at src/lib.rs. --- README.md | 2 +- src/lib.rs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a8d2ea..2d65726 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ async fn main() { }; // Read GeoTIFF into an ndarray::Array - let arr: Array3 = read_geotiff(stream).unwrap(); + let arr: Array3 = read_geotiff::(stream).unwrap(); assert_eq!(arr.dim(), (1, 549, 549)); assert_eq!(arr[[0, 500, 500]], 0.13482364); } diff --git a/src/lib.rs b/src/lib.rs index 1cec2fc..9c250f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,11 +38,16 @@ //! Cursor::new(bytes) //! }; //! -//! let arr: Array3 = read_geotiff(stream).unwrap(); +//! let arr: Array3 = read_geotiff::(stream).unwrap(); //! assert_eq!(arr.dim(), (1, 549, 549)); //! assert_eq!(arr[[0, 500, 500]], 0.13482364); //! } //! ``` +//! +//! Note that the output dtype can be specified either by using a type hint +//! (`let arr: Array3`) or via the turbofish operator (`read_geotiff::`). +//! Currently supported dtypes include uint (u8/u16/u32/u64), int (i8/i16/i32/i64) and +//! float (f32/f64). /// Modules for handling Input/Output of GeoTIFF data pub mod io;