Compare commits

..

19 commits
v0.2.0 ... HEAD

Author SHA1 Message Date
73007bc626
Move weekly audit run to Saturday at 23:00 [ci-skip]
All checks were successful
Audit dependencies / audit (push) Successful in 5s
Check, lint and test / Check, lint and test (push) Successful in 56s
2024-07-27 15:22:31 +02:00
edfc07d729
Add audit workflow (runs on Saturdays at 0:00)
All checks were successful
Audit dependencies / audit (push) Successful in 6s
Check, lint and test / Check, lint and test (push) Successful in 43s
2024-07-27 15:15:21 +02:00
7cf7a9e3a0
Switch to Forgejo Actions
Also simplify the workflows by using the Rust images.
2024-07-27 15:12:50 +02:00
0ef589a5ac Add a full Gitea Actions release workflow
All checks were successful
Check, lint and test using Cargo / Check, lint and test (push) Successful in 1m37s
2024-04-03 21:45:05 +02:00
8b69470cff Bump the version to 0.2.2
All checks were successful
Check, lint and test using Cargo / Check, lint and test (push) Successful in 1m29s
2024-04-03 21:40:04 +02:00
071473ffcf Specify which files to package for publishing 2024-04-03 21:39:48 +02:00
867397d2db Update the changelog 2024-04-03 21:34:47 +02:00
54e3540946 Bump the dependency on derived_builder to 0.20.0 2024-04-03 21:31:50 +02:00
c63bdceb01
Simplify Gitea Actions check and lint workflow
All checks were successful
Check, lint and test using Cargo / Check, lint and test (push) Successful in 1m42s
2023-04-25 16:34:08 +02:00
00856f4dd9
Speed up workflow by using sparce Cargo index for crates.io
All checks were successful
Check
Lints
Test Suite
2023-03-21 11:45:16 +01:00
e6f02664b7
Tweak the cargo workflow a bit more
All checks were successful
Check
Lints
Test Suite
- Run using the `debian-latest` image
- Use local `actions/checkout` where possible
- Small reordering
2023-03-21 10:48:11 +01:00
bbd061f0d3
Enable all features during CI test step
All checks were successful
Check
Lints
Test Suite
2023-03-20 21:18:50 +01:00
ca86701ee8
Add CI workflow for Cargo using Gitea Actions
Some checks failed
Check
Lints
Test Suite
2023-03-20 21:06:26 +01:00
aa9d2b88f7
Bump the version to 0.2.1 2023-03-11 19:54:59 +01:00
0c158e13b7
Update the changelog 2023-03-11 19:54:38 +01:00
abf3234a25
Fix typo in docs.rs metadata section name 2023-03-11 19:43:06 +01:00
be4ebc26e1
Bump dependency on derive_builder 2023-03-07 14:55:51 +01:00
f00fbc76ab
Fix links in README
In rustdoc, the crate's own types don't need to be linked, but for some
web view that uses plain Markdown, the links looked weird. Fix this by
linkin the crates' own types too.
2022-10-13 19:30:40 +02:00
129b29da26
Use assert_eq for float tests; drop dev depend on float_eq crate 2022-10-08 15:03:16 +02:00
7 changed files with 192 additions and 53 deletions

View file

@ -0,0 +1,26 @@
name: "Audit dependencies"
on:
push:
branches:
- main
paths:
- '.forgejo/workflows/audit.yml'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/audit.toml'
schedule:
- cron: '0 23 * * 6'
workflow_dispatch:
jobs:
audit:
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run cargo audit
run: cargo audit

View file

@ -0,0 +1,28 @@
name: "Check, lint and test"
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
check_lint:
name: Check, lint and test
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Run cargo check
run: cargo check --all-features
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo test
run: cargo test --all-features

View file

@ -0,0 +1,65 @@
name: "Release"
on:
push:
tags:
- v*
jobs:
release:
name: "Release"
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Determine the repository name and version of the release
run: |
REPO_NAME=$(basename $GITHUB_REPOSITORY)
VERSION=${GITHUB_REF_NAME#v}
echo "Releasing version of $REPO_NAME: $VERSION"
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Get the release notes from the changelog
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
RELEASE_NOTES=$(sed -n -e "/^## \[$VERSION\]/,/^## \[/{//"'!'"p;}" CHANGELOG.md | sed -e '1d;$d')
echo "Release notes:"
echo
echo "$RELEASE_NOTES"
echo "RELEASE_NOTES<<$EOF" >> "$GITHUB_ENV"
echo "$RELEASE_NOTES" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
- name: Build a release binary
run: |
# FIXME: There is no binary to build, really...
mkdir -p dist
touch dist/no-binaries
- name: Release to Forgejo
uses: paul/forgejo-release@main
with:
direction: upload
release-dir: dist
release-notes: '${{ env.RELEASE_NOTES }}'
title: 'Release ${{ env.VERSION }}'
token: '${{ secrets.RELEASE_TOKEN }}'
release-crate:
name: "Release Rust crate"
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run cargo publish
run: cargo publish --registry luon
env:
CARGO_REGISTRIES_LUON_INDEX: 'sparse+${{ github.server_url }}/api/packages/${{ github.repository_owner }}/cargo/'
CARGO_REGISTRIES_LUON_TOKEN: 'Bearer ${{ secrets.CARGO_TOKEN }}'

View file

@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [0.2.2] - 2024-04-03
### Changed
* Bumped dependency on `derive_builder` crate
## [0.2.1] - 2023-03-11
### Changed
* Bumped dependency on `derive_builder` crate
* Use `assert_eq` for float tests; drop dev depend on `float_eq` crate
### Fixed
* Fix doclinks in README
* Fix docs.rs metadata section name in `Cargo.toml`
## [0.2.0] - 2022-10-01 ## [0.2.0] - 2022-10-01
### Added ### Added
@ -30,6 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fix some small errors in the documentation * Fix some small errors in the documentation
[Unreleased]: https://git.luon.net/paul/geo-uri-rs/compare/v0.2.0...HEAD [Unreleased]: https://git.luon.net/paul/geo-uri-rs/compare/v0.2.2...HEAD
[0.2.2]: https://git.luon.net/paul/geo-uri-rs/compare/v0.2.1..v0.2.2
[0.2.1]: https://git.luon.net/paul/geo-uri-rs/compare/v0.2.0..v0.2.1
[0.2.0]: https://git.luon.net/paul/geo-uri-rs/compare/v0.1.1..v0.2.0 [0.2.0]: https://git.luon.net/paul/geo-uri-rs/compare/v0.1.1..v0.2.0
[0.1.1]: https://git.luon.net/paul/geo-uri-rs/commits/tag/v0.1.1 [0.1.1]: https://git.luon.net/paul/geo-uri-rs/commits/tag/v0.1.1

View file

@ -1,6 +1,6 @@
[package] [package]
name = "geo-uri" name = "geo-uri"
version = "0.2.0" version = "0.2.2"
authors = ["Paul van Tilburg <paul@luon.net>"] authors = ["Paul van Tilburg <paul@luon.net>"]
edition = "2021" edition = "2021"
rust-version = "1.60.0" rust-version = "1.60.0"
@ -10,8 +10,9 @@ repository = "https://git.luon.net/paul/geo-uri-rs"
license = "MIT" license = "MIT"
keywords = ["geolocation", "uri", "parser", "rfc5870"] keywords = ["geolocation", "uri", "parser", "rfc5870"]
categories = ["parser-implementations", "web-programming", "encoding"] categories = ["parser-implementations", "web-programming", "encoding"]
include = ["CHANGELOG.md", "LICENSE", "README.md", "src/*.rs"]
[package.metadata.docs.rs] [package.metadata."docs.rs"]
all-features = true all-features = true
rustdoc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"]
@ -20,11 +21,10 @@ url = ["dep:url"]
serde = ["dep:serde"] serde = ["dep:serde"]
[dependencies] [dependencies]
derive_builder = "0.11.2" derive_builder = "0.20.0"
serde = { version = "1.0.145", optional = true } serde = { version = "1.0.145", optional = true }
thiserror = "1.0.35" thiserror = "1.0.35"
url = { version = "2.3.1", optional = true } url = { version = "2.3.1", optional = true }
[dev-dependencies] [dev-dependencies]
float_eq = "1.0.0"
serde_test = "1.0.145" serde_test = "1.0.145"

View file

@ -24,7 +24,7 @@ $ cargo add geo-uri
Use either the [`TryFrom`](std::convert::TryFrom) trait or the Use either the [`TryFrom`](std::convert::TryFrom) trait or the
[`parse`](str::parse) method on strings to parse a geo URI string into a [`parse`](str::parse) method on strings to parse a geo URI string into a
[`GeoUri`] struct: [`GeoUri`](GeoUri) struct:
```rust ```rust
use geo_uri::GeoUri; use geo_uri::GeoUri;
@ -56,8 +56,8 @@ assert_eq!(geo_uri.uncertainty(), None);
### Generating ### Generating
Use the [`GeoUriBuilder`] to construct a [`GeoUri`] struct. Use the [`GeoUriBuilder`](GeoUriBuilder) to construct a [`GeoUri`](GeoUri)
Then, use either the [`ToString`](std::string::ToString) or struct. Then, use either the [`ToString`](std::string::ToString) or
[`Display`](std::fmt::Display) trait to generate a geo URI string: [`Display`](std::fmt::Display) trait to generate a geo URI string:
```rust ```rust
@ -80,8 +80,8 @@ assert_eq!(
); );
``` ```
It is also possible to construct a [`GeoUri`] struct from coordinate tuples It is also possible to construct a [`GeoUri`](GeoUri) struct from coordinate
using the [`TryFrom`](std::convert::TryFrom) trait: tuples using the [`TryFrom`](std::convert::TryFrom) trait:
```rust ```rust
use geo_uri::GeoUri; use geo_uri::GeoUri;
@ -115,13 +115,14 @@ let geo_url = Url::from(geo_uri);
assert_eq!(url, geo_url); assert_eq!(url, geo_url);
``` ```
Note that it is always possible to transform a [`GeoUri`] into an [`Url`], but Note that it is always possible to transform a [`GeoUri`](GeoUri) into an
not always the other way around! This is because the format of the coordinates [`Url`](https://docs.rs/url/2/url/struct.Url.html), but not always the other
and parameters after the URI scheme "geo:" may be invalid! way around! This is because the format of the coordinates and parameters after
the URI scheme "geo:" may be invalid!
### Feature: `serde` ### Feature: `serde`
If you enable the `serde` feature, [`GeoUri`] will implement If you enable the `serde` feature, [`GeoUri`](GeoUri) will implement
[`serde::Serialize`](https://docs.rs/serde/1/serde/trait.Serialize.html) and [`serde::Serialize`](https://docs.rs/serde/1/serde/trait.Serialize.html) and
[`serde::Deserialize`](https://docs.rs/serde/1/serde/trait.Deserialize.html). [`serde::Deserialize`](https://docs.rs/serde/1/serde/trait.Deserialize.html).
See the [serde](https://serde.rs) documentation for more information. See the [serde](https://serde.rs) documentation for more information.

View file

@ -624,7 +624,6 @@ impl GeoUriBuilder {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use float_eq::assert_float_eq;
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde_test::{assert_de_tokens_error, assert_tokens, Token}; use serde_test::{assert_de_tokens_error, assert_tokens, Token};
@ -662,8 +661,8 @@ mod tests {
builder.longitude(5.134); builder.longitude(5.134);
let geo_uri = builder.build()?; let geo_uri = builder.build()?;
assert_float_eq!(geo_uri.latitude, 52.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 52.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_eq!(geo_uri.altitude, None); assert_eq!(geo_uri.altitude, None);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
@ -691,8 +690,8 @@ mod tests {
#[test] #[test]
fn geo_uri_parse() -> Result<(), Error> { fn geo_uri_parse() -> Result<(), Error> {
let geo_uri = GeoUri::parse("geo:52.107,5.134")?; let geo_uri = GeoUri::parse("geo:52.107,5.134")?;
assert_float_eq!(geo_uri.latitude, 52.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 52.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_eq!(geo_uri.altitude, None); assert_eq!(geo_uri.altitude, None);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
@ -727,9 +726,9 @@ mod tests {
assert!(matches!(geo_uri, Err(Error::InvalidCoord(_)))); assert!(matches!(geo_uri, Err(Error::InvalidCoord(_))));
let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6")?; let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6")?;
assert_float_eq!(geo_uri.latitude, 52.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 52.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_float_eq!(geo_uri.altitude.unwrap(), 3.6, abs <= 0.1); assert_eq!(geo_uri.altitude.unwrap(), 3.6);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
let geo_uri = GeoUri::parse("geo:52.107,5.34,3.6;u="); let geo_uri = GeoUri::parse("geo:52.107,5.34,3.6;u=");
@ -745,24 +744,24 @@ mod tests {
assert!(matches!(geo_uri, Err(Error::OutOfRangeUncertainty))); assert!(matches!(geo_uri, Err(Error::OutOfRangeUncertainty)));
let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6;u=25000")?; let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6;u=25000")?;
assert_float_eq!(geo_uri.latitude, 52.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 52.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_float_eq!(geo_uri.altitude.unwrap(), 3.6, abs <= 0.1); assert_eq!(geo_uri.altitude.unwrap(), 3.6);
assert_eq!(geo_uri.uncertainty, Some(25_000.0)); assert_eq!(geo_uri.uncertainty, Some(25_000.0));
let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6;crs=wgs84;u=25000")?; let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6;crs=wgs84;u=25000")?;
assert_float_eq!(geo_uri.latitude, 52.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 52.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_float_eq!(geo_uri.altitude.unwrap(), 3.6, abs <= 0.1); assert_eq!(geo_uri.altitude.unwrap(), 3.6);
assert_eq!(geo_uri.uncertainty, Some(25_000.0)); assert_eq!(geo_uri.uncertainty, Some(25_000.0));
let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6;CRS=wgs84;U=25000")?; let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6;CRS=wgs84;U=25000")?;
assert_eq!(geo_uri.uncertainty, Some(25_000.0)); assert_eq!(geo_uri.uncertainty, Some(25_000.0));
let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6;crs=wgs84;u=25000;foo=bar")?; let geo_uri = GeoUri::parse("geo:52.107,5.134,3.6;crs=wgs84;u=25000;foo=bar")?;
assert_float_eq!(geo_uri.latitude, 52.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 52.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_float_eq!(geo_uri.altitude.unwrap(), 3.6, abs <= 0.1); assert_eq!(geo_uri.altitude.unwrap(), 3.6);
assert_eq!(geo_uri.uncertainty, Some(25_000.0)); assert_eq!(geo_uri.uncertainty, Some(25_000.0));
let geo_uri = GeoUri::parse("geo:52.107,5.34,3.6;crs=foo"); let geo_uri = GeoUri::parse("geo:52.107,5.34,3.6;crs=foo");
@ -773,21 +772,21 @@ mod tests {
// Examples from RFC 5870 (sections 1, 6.1, 6.2 and 9.4)! // Examples from RFC 5870 (sections 1, 6.1, 6.2 and 9.4)!
let geo_uri = GeoUri::parse("geo:13.4125,103.8667")?; let geo_uri = GeoUri::parse("geo:13.4125,103.8667")?;
assert_float_eq!(geo_uri.latitude, 13.4125, abs <= 0.0001); assert_eq!(geo_uri.latitude, 13.4125);
assert_float_eq!(geo_uri.longitude, 103.8667, abs <= 0.0001); assert_eq!(geo_uri.longitude, 103.8667);
assert_eq!(geo_uri.altitude, None); assert_eq!(geo_uri.altitude, None);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
let geo_uri = GeoUri::parse("geo:48.2010,16.3695,183")?; let geo_uri = GeoUri::parse("geo:48.2010,16.3695,183")?;
assert_float_eq!(geo_uri.latitude, 48.2010, abs <= 0.0001); assert_eq!(geo_uri.latitude, 48.2010);
assert_float_eq!(geo_uri.longitude, 16.3695, abs <= 0.0001); assert_eq!(geo_uri.longitude, 16.3695);
assert_float_eq!(geo_uri.altitude.unwrap(), 183.0, abs <= 0.1); assert_eq!(geo_uri.altitude.unwrap(), 183.0);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
let geo_uri = GeoUri::parse("geo:48.198634,16.371648;crs=wgs84;u=40")?; let geo_uri = GeoUri::parse("geo:48.198634,16.371648;crs=wgs84;u=40")?;
assert_eq!(geo_uri.crs, CoordRefSystem::Wgs84); assert_eq!(geo_uri.crs, CoordRefSystem::Wgs84);
assert_float_eq!(geo_uri.latitude, 48.198634, abs <= 0.000001); assert_eq!(geo_uri.latitude, 48.198634);
assert_float_eq!(geo_uri.longitude, 16.371648, abs <= 0.000001); assert_eq!(geo_uri.longitude, 16.371648);
assert_eq!(geo_uri.altitude, None); assert_eq!(geo_uri.altitude, None);
assert_eq!(geo_uri.uncertainty, Some(40.0)); assert_eq!(geo_uri.uncertainty, Some(40.0));
@ -896,8 +895,8 @@ mod tests {
#[test] #[test]
fn geo_uri_from_str() -> Result<(), Error> { fn geo_uri_from_str() -> Result<(), Error> {
let geo_uri = GeoUri::from_str("geo:52.107,5.134")?; let geo_uri = GeoUri::from_str("geo:52.107,5.134")?;
assert_float_eq!(geo_uri.latitude, 52.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 52.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_eq!(geo_uri.altitude, None); assert_eq!(geo_uri.altitude, None);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
@ -930,15 +929,15 @@ mod tests {
fn geo_uri_try_from() -> Result<(), Error> { fn geo_uri_try_from() -> Result<(), Error> {
// &str // &str
let geo_uri = GeoUri::try_from("geo:52.107,5.134")?; let geo_uri = GeoUri::try_from("geo:52.107,5.134")?;
assert_float_eq!(geo_uri.latitude, 52.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 52.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_eq!(geo_uri.altitude, None); assert_eq!(geo_uri.altitude, None);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
// (f64, f64) // (f64, f64)
let geo_uri = GeoUri::try_from((51.107, 5.134))?; let geo_uri = GeoUri::try_from((51.107, 5.134))?;
assert_float_eq!(geo_uri.latitude, 51.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 51.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_eq!(geo_uri.altitude, None); assert_eq!(geo_uri.altitude, None);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
@ -953,9 +952,9 @@ mod tests {
// (f64, f64, f64) // (f64, f64, f64)
let geo_uri = GeoUri::try_from((51.107, 5.134, 3.6))?; let geo_uri = GeoUri::try_from((51.107, 5.134, 3.6))?;
assert_float_eq!(geo_uri.latitude, 51.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 51.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_float_eq!(geo_uri.altitude.unwrap(), 3.6, abs <= 0.1); assert_eq!(geo_uri.altitude.unwrap(), 3.6);
assert_eq!(geo_uri.uncertainty, None); assert_eq!(geo_uri.uncertainty, None);
assert_eq!( assert_eq!(
@ -976,15 +975,15 @@ mod tests {
// Url // Url
let url = Url::parse("geo:51.107,5.134,3.6;crs=wgs84;u=1000;foo=bar").expect("valid URL"); let url = Url::parse("geo:51.107,5.134,3.6;crs=wgs84;u=1000;foo=bar").expect("valid URL");
let geo_uri = GeoUri::try_from(&url)?; let geo_uri = GeoUri::try_from(&url)?;
assert_float_eq!(geo_uri.latitude, 51.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 51.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_float_eq!(geo_uri.altitude.unwrap(), 3.6, abs <= 0.1); assert_eq!(geo_uri.altitude.unwrap(), 3.6);
assert_eq!(geo_uri.uncertainty, Some(1000.0)); assert_eq!(geo_uri.uncertainty, Some(1000.0));
let geo_uri = GeoUri::try_from(url)?; let geo_uri = GeoUri::try_from(url)?;
assert_float_eq!(geo_uri.latitude, 51.107, abs <= 0.001); assert_eq!(geo_uri.latitude, 51.107);
assert_float_eq!(geo_uri.longitude, 5.134, abs <= 0.001); assert_eq!(geo_uri.longitude, 5.134);
assert_float_eq!(geo_uri.altitude.unwrap(), 3.6, abs <= 0.1); assert_eq!(geo_uri.altitude.unwrap(), 3.6);
assert_eq!(geo_uri.uncertainty, Some(1000.0)); assert_eq!(geo_uri.uncertainty, Some(1000.0));
Ok(()) Ok(())