Rust - Testing

Rust has built-in support for testing with the cargo and assert. We can write tests in Rust using the #[test] attribute and the assert! macro. The cargo command-line interface can be used to run the tests. The tests can be written in the same file as the code being tested, or in a separate file. Writing Tests Suppose we have a function add in main.rs which adds two numbers. // main.rs pub fn add(a: i32, b: i32) -> i32 { a + b } We can write a test for this function in the same file. ...

Rust - Overview

Rust is a systems programming language that prioritizes safety, speed, and concurrency without relying on a garbage collector. Its unique ownership model enforces memory safety and makes system-level programming more efficient. Rust is widely used in operating systems, game engines, and web applications for its performance and reliability, Also in some Web Clients using WASM. Few things I like about Rust are The ownership system, which ensures memory safety without a garbage collector. The powerful match statement for pattern matching and error handling. The zero-cost abstractions provided by traits and generics. Few things I dislike about Rust are ...