<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Miguel Rivera</title>
    <description>The latest articles on Forem by Miguel Rivera (@miguelrivera_).</description>
    <link>https://forem.com/miguelrivera_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F428591%2F78d6b979-19cf-40a3-8c3b-b4867e693d2c.jpeg</url>
      <title>Forem: Miguel Rivera</title>
      <link>https://forem.com/miguelrivera_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/miguelrivera_"/>
    <language>en</language>
    <item>
      <title>Tuts: RUST 101</title>
      <dc:creator>Miguel Rivera</dc:creator>
      <pubDate>Mon, 22 Jan 2024 07:16:05 +0000</pubDate>
      <link>https://forem.com/miguelrivera_/tuts-rust-101-2hi3</link>
      <guid>https://forem.com/miguelrivera_/tuts-rust-101-2hi3</guid>
      <description>&lt;p&gt;This short tutorial is the first one of a series aimed at introducing beginners to new programming languages.&lt;/p&gt;

&lt;p&gt;Rust is an advanced and robust programming language that prioritizes memory safety, concurrency, and performance. &lt;/p&gt;

&lt;p&gt;For beginners looking to begin their journey with Rust, this short tutorial will provide a step-by-step guide on setting up Rust and creating your initial program.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 1: Install Rust&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To begin, you'll need to install Rust on your machine. Visit the official Rust website at rust-lang.org and follow the installation instructions for your operating system. &lt;/p&gt;

&lt;p&gt;The installation process should be straightforward and well-documented.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Set Up Your Development Environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once Rust is installed, you must set up your development environment. Rust comes with a command-line tool called cargo, making creating, building, and managing Rust projects easy.&lt;/p&gt;

&lt;p&gt;Open your terminal or command prompt and run the following command to verify that Rust is installed correctly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rustc --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see the version number printed, you're good to go!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Create a New Rust Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, let's create a new Rust project. In your terminal or command prompt, navigate to the directory where you want to make your project. Run the following command to start a new project using cargo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cargo new my_project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new directory called my_project with the basic structure of a Rust project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Write Your First Rust Program&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Navigate into the newly created my_project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd my_project

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the project in your favorite code editor and locate the src directory. Inside the src directory, you'll find a file named main.rs. This is where you'll write your first Rust program.&lt;/p&gt;

&lt;p&gt;Open main.rs and replace the existing code with the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn main() {
    println!("Hello, Rust!");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Build and Run Your Program&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To build and run your program, go back to your terminal or command prompt and navigate to the root directory of your project (my_project). Run the following command to build your program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cargo build

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If there are no errors, you should see a message indicating that the build was successful.&lt;/p&gt;

&lt;p&gt;To run your program, enter the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cargo run

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the output. Hello, Rust! Printed in your terminal.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 6: Explore Further&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Congratulations&lt;/strong&gt;! &lt;/p&gt;

&lt;p&gt;You've written and executed your first Rust program. You can continue exploring the Rust programming language from here by reading the official Rust documentation at &lt;a href="https://www.rust-lang.org/learn/get-started" rel="noopener noreferrer"&gt;https://www.rust-lang.org/learn/get-started&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Many online resources, tutorials, and books are available to help you get deeper into Rust and expand your knowledge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's it!&lt;/strong&gt; You've completed the beginner's guide to Rust. &lt;/p&gt;

</description>
      <category>rust</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
