Google Rust Linux

FYI

Google Linux in Rust

I just saw this articled dated 17 June 2021, apologies if this has already been posted.

Google, IMHO, is a rather strange crowd, they dont have any Rust support for Google Cloud Platform as far as I can find and no Rust examples either.
I found some crates for GCP but they seem to be highly experimental, at best.
I managed to use GCP via reqwest REST crate, which worked but is rather crude, IMO.

AWS and Microsoft Azure Rust support is much more advanced than Google GCP.

1 Like

Not sure if I quite follow you here- are you measuring things in a Cloud Provider platform built for Rust, or things built with Rust for the platform?

All three of the cloud providers have announced plans to build things with Rust, be it Google using Rust to aid in future editions of Android, AWS's vocal praise of the language (which I believe they announced alongside ~100 job openings for Rust), or Microsoft Joining the Rust Foundation. These are all tremendously good news for the language after being kicked out of the nest at Mozilla.

But if you mean using a platform to build with Rust, the only thing I can thing of that has a meaningful difference is serverless (called Lambda at AWS, functions at Azure and Google). All three support Python, Java, Go, and Node.js I believe. While Rust is not yet a first-class citizen for Lambda, AWS is the closest to being there with their bring-your-own-runtime that can be used to write serverless Rust like this example.

1 Like

thank you, yes, I meant using Rust to access all Google GCP app services, i.e. the Rust SDK for GCP as currently exists for other languages like Java, Python, C#, etc. I wanted to see the same level SDK for Rust for all cloud platforms. It appears to me that there is more "help" in AWS and Microsoft Azure for Rust today than in Google GCP. If I am wrong, please provide some pointers, crates, etc. Many thanks!

1 Like

The two I can see are gcloud and google-cloud. What is your use case?

1 Like

thanks, I will have a look.
I am calling Google Maps API to convert latitude and longitude coordinates to the human-readable street address including the country. I have been calling reqwest crate blocking get with https strings like this:

https://maps.googleapis.com/maps/api/geocode/json?result_type=point_of_interest|street_address|country&latlng=48.86222,2.33083&key=xxxxx

to retrieve and parse the JSON. Its crude and not idiomatic, I suspect, but it works. I was always looking for more elegant/idiomatic solution in Rust.

So what is left to do? The Reqwest crate should work fine. If you are okay with blocking you might also consider ureq.

Can you show an example of the output? Have you used serde and serde_json to parse the output?

2 Likes

Using reqwest and parsing the response using serde_json is probably the idiomatic way to do this -- it's just a normal web API you're interacting with after all. Maybe other Rustaceans can provide more detail on the best approach -- there might be some stuff to help with this that I'm not aware of.

I'm guessing you're referring to the pre-packaged client libraries: Client Libraries for Google Maps Web Services that support JS, Node, Go, Java. These usually just provide convenient wrappers around the web API calls. I guess there aren't enough Rust users who want to hit the maps API yet. Ditto for C# or C++.

Luckily the API is fairly well documented, so it should be fairly straightforward dealing with the responses, especially if you have a couple of specific use cases in mind.

1 Like

all is working, I just thought as a novice Rust programmer that I am not doing this idiomatically. I have used serde to parse JSON and everything has worked. Perhaps I was being too self-critical, as a Rust learner.
Thank you for your support.

1 Like

Sounds like you are well one your way! It is probably overkill, but if you wanted to practice publishing your first crate, you could make something like google_geocoding_client to make it easier for the next person.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.