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

small improvements to doc comprehensibility #243

Merged
merged 1 commit into from
Jul 4, 2024
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
6 changes: 3 additions & 3 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! }
//! ```
//!
//! Your type *must* have a field called `geometry` and it must be `deserialized_with` [`deserialize_geometry`](crate::de::deserialize_geometry):
//! Your type *must* have a field called `geometry` and it must be `deserialize_with` [`deserialize_geometry`](crate::de::deserialize_geometry):
//! ```rust, ignore
//! #[derive(serde::Deserialize)]
//! struct MyStruct {
Expand All @@ -30,7 +30,7 @@
//!
//! #[derive(Deserialize)]
//! struct MyStruct {
//! // Deserialize from geojson, rather than expecting the type's default serialization
//! // Deserialize from GeoJSON, rather than expecting the type's default serialization
//! #[serde(deserialize_with = "deserialize_geometry")]
//! geometry: geo_types::Point<f64>,
//! name: String,
Expand Down Expand Up @@ -76,7 +76,7 @@
//! ```ignore
//! #[derive(serde::Serialize, serde::Deserialize)]
//! struct MyStruct {
//! // Serialize as geojson, rather than using the type's default serialization
//! // Serialize as GeoJSON, rather than using the type's default serialization
//! #[serde(serialize_with = "serialize_geometry", deserialize_with = "deserialize_geometry")]
//! geometry: geo_types::Point<f64>,
//! ...
Expand Down
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
//! 1. A [`Geometry`] represents points, curves, and surfaces in coordinate space.
//! 2. A [`Feature`] usually contains a `Geometry` and some associated data, for example a "name"
//! field or any other properties you'd like associated with the `Geometry`.
//! 3. A [`FeatureCollection`] is a list of one or more `Feature`s.
//! 3. A [`FeatureCollection`] is a list of `Feature`s.
//!
//! Because [`Feature`] and [`FeatureCollection`] are more flexible, bare [`Geometry`] GeoJSON
//! documents are rarely encountered in the wild. As such, conversions from [`Geometry`]
Expand Down Expand Up @@ -172,21 +172,21 @@
//! GeoJson::FeatureCollection(ref ctn) => {
//! for feature in &ctn.features {
//! if let Some(ref geom) = feature.geometry {
//! match_geometry(geom)
//! process_geometry(geom)
//! }
//! }
//! }
//! GeoJson::Feature(ref feature) => {
//! if let Some(ref geom) = feature.geometry {
//! match_geometry(geom)
//! process_geometry(geom)
//! }
//! }
//! GeoJson::Geometry(ref geometry) => match_geometry(geometry),
//! GeoJson::Geometry(ref geometry) => process_geometry(geometry),
//! }
//! }
//!
//! /// Process GeoJSON geometries
//! fn match_geometry(geom: &Geometry) {
//! fn process_geometry(geom: &Geometry) {
//! match geom.value {
//! Value::Polygon(_) => println!("Matched a Polygon"),
//! Value::MultiPolygon(_) => println!("Matched a MultiPolygon"),
Expand All @@ -195,7 +195,7 @@
//! // !!! GeometryCollections contain other Geometry types, and can
//! // nest — we deal with this by recursively processing each geometry
//! for geometry in gc {
//! match_geometry(geometry)
//! process_geometry(geometry)
//! }
//! }
//! // Point, LineString, and their Multi– counterparts
Expand Down Expand Up @@ -299,7 +299,7 @@
//!
//! The `geo-types` feature implements the [`TryFrom`](../std/convert/trait.TryFrom.html) trait,
//! providing **fallible** conversions _to_ [geo-types Geometries](../geo_types/index.html#structs)
//! from [`GeoJson`], [`Value`], or [`Geometry`] types.
//! from [`GeoJson`], [`Value`], [`Feature`], [`FeatureCollection`] or [`Geometry`] types.
//!
//! #### Convert `geojson` to `geo_types::Geometry<f64>`
//!
Expand Down
6 changes: 3 additions & 3 deletions src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! }
//! ```
//!
//! Your type *must* have a field called `geometry` and it must be `serialized_with` [`serialize_geometry`](crate::ser::serialize_geometry):
//! Your type *must* have a field called `geometry` and it must be `serialize_with` [`serialize_geometry`](crate::ser::serialize_geometry):
//! ```rust, ignore
//! #[derive(serde::Serialize)]
//! struct MyStruct {
Expand Down Expand Up @@ -85,12 +85,12 @@
//!
//! # Reading *and* Writing GeoJSON
//!
//! This module is only concerned with Writing out GeoJSON. If you'd also like to reading GeoJSON,
//! This module is only concerned with Writing out GeoJSON. If you'd also like to read GeoJSON,
//! you'll want to combine this with the functionality from the [`crate::de`] module:
//! ```ignore
//! #[derive(serde::Serialize, serde::Deserialize)]
//! struct MyStruct {
//! // Serialize as geojson, rather than using the type's default serialization
//! // Serialize as GeoJSON, rather than using the type's default serialization
//! #[serde(serialize_with = "serialize_geometry", deserialize_with = "deserialize_geometry")]
//! geometry: geo_types::Point<f64>,
//! ...
Expand Down