DEV Community

Cover image for The Rust
Taimoor khan
Taimoor khan

Posted on

2 2

The Rust

According to StackOverflow's Developer Survey Rust is most loved programming language for developers for past consecutive 5 years.

Rust is a statically typed programming language that promises Safety and Performance. It has modern yet hard to digest syntax and provides low level control (such as memory usage, pointers etc).
Rust is statically typed compiled language without anything like Garbage Collectors.

Question: How does Rust guarantee memory memory safety?
Answer: Rust manages memory through a system of Ownership with a set of rules that the compiler checks at compile time.

Hello World

Let's write our first program in Rust.

fn main(){
  println!("Hello World");
}
Enter fullscreen mode Exit fullscreen mode

User Input In Rust

Some types are not included in prelude so we need to explicitly call them into the scope by using use keyword. The std::io library provides number of useful features, including the ability to accept user input.

use std::io;

fn main(){
  println!("Your good name?:");

  let mut user_in = String::new();
  io::stdin()
      .readline(&mut user_in)
      .expect("something happened!");

  println!("Happy coding {}", user_in); 


}
Enter fullscreen mode Exit fullscreen mode

Do you think rust will dominate other statically typed languages?

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs