diff --git a/stac/src/io.rs b/stac/src/io.rs index b9521d06a..5f218080d 100644 --- a/stac/src/io.rs +++ b/stac/src/io.rs @@ -17,14 +17,7 @@ pub fn read(href: impl ToString) -> Result { Ok(value) } -/// Reads any deserializable value from the JSON at an href. -/// -/// # Examples -/// -/// ``` -/// let value: stac::Item = stac::read_json("data/simple-item.json").unwrap(); -/// ``` -pub fn read_json(href: &str) -> Result +pub(crate) fn read_json(href: &str) -> Result where T: DeserializeOwned, { diff --git a/stac/src/item.rs b/stac/src/item.rs index 6504dbf23..dd3121ad4 100644 --- a/stac/src/item.rs +++ b/stac/src/item.rs @@ -802,7 +802,7 @@ mod tests { #[test] fn deserialize_invalid_type_field() { - let mut item: Value = crate::read_json("data/simple-item.json").unwrap(); + let mut item: Value = crate::io::read_json("data/simple-item.json").unwrap(); item["type"] = "Item".into(); // must be "Feature" assert!(serde_json::from_value::(item).is_err()); } diff --git a/stac/src/lib.rs b/stac/src/lib.rs index 673737eb9..29d161aba 100644 --- a/stac/src/lib.rs +++ b/stac/src/lib.rs @@ -151,7 +151,7 @@ pub use { extensions::{Extension, Extensions}, fields::Fields, href::{href_to_url, Href}, - io::{read, read_json}, + io::read, item::{FlatItem, Item, Properties, ITEM_TYPE}, item_collection::{ItemCollection, ITEM_COLLECTION_TYPE}, link::{Link, Links}, diff --git a/stac/src/migrate.rs b/stac/src/migrate.rs index efa15a626..d8c284de9 100644 --- a/stac/src/migrate.rs +++ b/stac/src/migrate.rs @@ -221,7 +221,7 @@ mod tests { assert_eq!(asset.bands[2].name.as_ref().unwrap(), "b"); assert_eq!(asset.bands[3].name.as_ref().unwrap(), "nir"); - let expected: Value = crate::read_json("examples/bands-v1.1.0-beta.1.json").unwrap(); + let expected: Value = crate::io::read_json("examples/bands-v1.1.0-beta.1.json").unwrap(); assert_json_eq!(expected, serde_json::to_value(item).unwrap()); let collection = Collection::new("an-id", "a description");