Getting Started with Rust

I’m learning Rust by updating a library, this is tricky.

Resources to get started


Async Programming:

Notes on Async

Rust async execution is explicit and make sense: futures are inert, they don’t run if you’re not waiting for their result. Much different from JS for example: I never found a precise description of what happen to an async that is not await’d for.

Open Questions

What is the ? operator used in some_call().await?

It’s a way to rethrow exceptions, see:

What is the dyn parameter used in return value?


async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let (client, _run_parameters) = testground::client::Client::new().await?;


    // init();

What is the equivalent of a js / python lambda function?

They call it closures. Makes sense because they are capturing their env,

Doing async in these doesn’t work straight out of the box.

How can you inspect macros & decorators?

I couldn’t find what #[clap(env)] does, googling for clap, I get something about command line parsing:

I guess this is loading data from the env, but I couldn’t find explicit documentation immediately in VSCode.

use clap::Parser;

use std::path::PathBuf;

use ipnetwork::IpNetwork;

#[derive(Parser, Debug, Clone)]
pub struct RunParameters {
    pub test_plan: String, // TEST_PLAN: streaming_test
    pub test_case: String, // TEST_CASE: quickstart

Laurent Senta

I wrote software for large distributed systems, web applications, and even robots. Now I focus on decentralization, overly-engineered software, and frugal innovation. I help companies around the world build products through SingularGarden.