Closed emirror-de closed 2 months ago
Ah I found something: Removing default-features = false, features = ["directions", "reqwest", "rustls", "brotli"]
from Cargo.toml
compiles without error.
It seems that there is some interference in the feature flags?
Hey, it sounds like you mostly figured it out.
If you look under "Feature flag usage example" in the README.md there's an example.
Going from memory, I believe (?) at the time, one could not have a feature name with the same name as a crate dependency. So, the feature was called enable-reqwest
rather than the expected reqwest
.
Try using enable-reqwest
instead and let me know if this works for you.
When the default features are disabled, one must explicitly say they want to use the reqwest crate by using the enable-reqwest
feature, which will in-turn give access to the execute
method.
If the enable-reqwest
feature is not defined, one must manually forward the query string to the desired HTTP crate like so:
// Get query string from builder pattern:
let query_url = google_maps_client.time_zone(
LatLng::try_from_dec(dec!(50.090_903), dec!(14.400_512))?,
Utc::now()
).query_url();
// Insert your favourite HTTP client here:
let json = reqwest::get(query_url).await?.text().await?;
// Parse JSON string into a TimeZoneResponse structure:
let time_zone: TimeZoneResponse = json.parse()?;
This is useful if you would like to use a crate other than reqwest
or if this crate is being used in a Web Assembly (WASM) application
Hey thanks for your response and explanations! I managed to make it work now, somehow I seem to used it the wrong way :D
Dear Maintainer,
I created a binary in the examples folder to test the example from the docs of the directions API. But I do get the following error message when trying to compile:
According to the docs, the method should be available. Can you give me a hint what I am doing wrong?
I pushed the used code to a fork here.