Syntax

Rust Build and Run with Cargo Syntax

In Rust, build and run with cargo: creates and runs a project — cargo new app cargo run

Quick Answer

Syntax
cargo new app cargo run
RustSyntax

Build and Run with Cargo

Code example
cargo new app cargo run

Creates and runs a project.

Learn More

How to build and run with cargo in Rust

  1. Open your Rust file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Rust Build and Run with Cargo Syntax

Use cargo new app cargo run.

Related Syntax References

Frequently asked questions

What is the Rust syntax for build and run with cargo?

Use this pattern: cargo new app cargo run

Can I copy this Rust code example?

Yes. Use Copy code and adapt the example to your program.

Is this Rust syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify