006 Métodos
006.6 Gráficos
006.68 Software

1.1 Creando una aplicación Rust

I suppose you already installed Rust and Visual Studio Code on your local machine and also added the rust-analizer extension to VS Code. The rust-analizer provides support for the Rust programming language and features like intelligent code analysis, code completion, code navigation, and error highlighting.

Now, let’s start a new rust library project with the following command in a command prompt window:

cargo new wgpu_book_examples --lib

The “lib” flag tells Cargo that we want to create a library project rather than a binary-executable project. Here the project name is *wgpu_book_examples. Rust recommens that we should name our project using snake case, which means words in the name are in lowercase, with each space replaced by an underscore.

The wgpu_book_examples project contain a Rust file called lib.rs in the src/ folder. This file serves as the entry point for our library code, where we will put commonly used Rust code. Additionally, we will add two new folders, assets and examples to the project’s root directory. The assets folder will be used to store asset files such as image and font files, while the examples folder will contain the example projects. Thus, our project will have the following structure:

For every Rust application, there is a Cargo.toml file