MyLearning

10 Ways to Add Two Large Arrays in Rust Using ndarray

Rust’s ndarray crate is a powerful foundation for numerical and scientific computing — but just like with any data‑heavy workload, performance depends heavily on how you write your loops. To explore this, I built a small educational demo that evaluates 10 different techniques for adding two 2D matrices (Array2)

Unaligned Memory in Rust - Forcing Odd Addresses and Loading Data Safely

Rust provides strong guarantees about memory safety, alignment, and the behavior of references. However, when you step into the world of low‑level programming — manual allocation, pointer arithmetic, and raw memory manipulation — it becomes your job to uphold these guarantees. One interesting challenge: Can we intentionally place a u32 at an odd address and still read it safely?

Understanding addr_of! and addr_of_mut! - Safe Pointer Access

Rust is very strict about memory safety, especially when it comes to unaligned data. If you’ve ever worked with byte buffers, binary protocols, FFI, or #[repr(packed)] structs, you’ve probably run into an error like: “error: Reference to field of packed struct is unaligned”

This is Rust politely telling you: “Stop! Creating a reference here would be undefined behavior.”

In this article, we’ll look at why this happens and how Rust’s addr_of! and addr_of_mut! macros let you safely work with potentially unaligned or unsafe memory locations without creating invalid references.