Commit Graph

22 Commits

Author SHA1 Message Date
Paul van Tilburg 129b29da26
Use assert_eq for float tests; drop dev depend on float_eq crate 2022-10-08 15:03:16 +02:00
Paul van Tilburg 56a888d5a3
Add support for serde (closes: #2)
* Introduce and document the `serde` feature
* Implement `serde::Deserialize` and `serde::Serialize` for `GeoUri`
* Add tests
2022-10-01 15:41:19 +02:00
Paul van Tilburg ff32105fce
Enable all features and document them for docs.rs 2022-10-01 15:41:19 +02:00
Paul van Tilburg 758a3f8072
Add support for converting from/to Url structs (closes: #1)
* Introduce and document the `url` feature
* Implement `From<&GeoUri>` and `From<GeoUri>` for `Url`
* Implement `TryFrom<&Url>` and `TryFrom<Url>` for `GeoUri`
* Add and extend tests
2022-10-01 15:41:18 +02:00
Paul van Tilburg 2628e96740
Add support for conversion from coordinate tuples
* Implement the `TryFrom` trait for `GeoUri` for `(f64, f64)` and
  `(f64, f64, f64)`
* Extend the tests
* Update the documentation
2022-10-01 15:20:05 +02:00
Paul van Tilburg 76ff1c95da
Use a single validator function; update tests 2022-10-01 15:20:05 +02:00
Paul van Tilburg 8ad3d5dea7
Fix typos and improve examples 2022-10-01 15:19:59 +02:00
Paul van Tilburg 7f3d4128b8
Make crate adhere to Rust API guidelines
* Don't set the `homepage` field in `Cargo.toml` if it is the same as
  the repository (C-METADATA)
* Don't use `expect` but `?` in examples (C-QUESTION-MARK)
  (This cannot be fixed for the README for now, unfortunately)
* Document the errors for all methods which return a `Result`
  (C-FAILURE)
2022-10-01 13:53:02 +02:00
Paul van Tilburg df5901aa72
Include examples from RFC 5870 as tests 2022-09-29 22:24:00 +02:00
Paul van Tilburg 6a9c13d099
Change uncertainty distance to be of type f64
The uncertainty distance is a positive floating number.

* Validate this while parsing/building/using the setter
* Add the error variant `Error::OutOfRangeUncertainty` and change
  `Error::InvalidDistance` to `Error::InvalidUncertainty`
* Update the tests
2022-09-29 22:19:45 +02:00
Paul van Tilburg 2efdddc209
Add builder tests for required fields and validation 2022-09-29 21:45:00 +02:00
Paul van Tilburg fb888e4c1e
Handle (partly) uppercase parameter names 2022-09-29 21:33:28 +02:00
Paul van Tilburg 3e2584dcda
Add getters/setters for `GeoUri`
Also make all of its fields private.
This prevents parsing/building a valid geo URI and then making it
invalid by setting the latitude/longitude to something incorrect.
2022-09-29 21:25:01 +02:00
Paul van Tilburg e526fa0c5e
Rename the error type; sort and shorten some variants 2022-09-29 21:00:39 +02:00
Paul van Tilburg a8a655f388
Validate latitude/longitude coordinates for WGS-84
Implement this for the parser as well as the builder.

Also rename `CrsId` to `CoordRefSystem` and the `GeoUri.crs_id` field
to `GeoUri.crs`.
2022-09-29 20:51:30 +02:00
Paul van Tilburg a71b9e8a2b
Implement and improve test; fix altitude formatting error 2022-09-29 20:22:23 +02:00
Paul van Tilburg 530a0a4048
Add examples; tweak documentation 2022-09-29 19:54:01 +02:00
Paul van Tilburg f64e8d99cd
Fix builder requiring fields that are optional/have defaults 2022-09-29 19:54:01 +02:00
Paul van Tilburg 11412a7ff9
Enable a bunch of lints 2022-09-29 19:39:13 +02:00
Paul van Tilburg 537d944858
Set some warnings/error lints 2022-09-27 18:01:26 +02:00
Paul van Tilburg 7ec8dbc7d3
Add README.md and LICENSE file
Also link the files from the crate and include `README.md` as the
crate documentation.
2022-09-27 18:00:03 +02:00
Paul van Tilburg 2029eadb3c
Initial import into Git 2022-09-27 17:10:45 +02:00