Author: Jarlath

RUST: Struct vs Vec

They serve very different purposes but are used together when handing database queries. Struct (Structure) Example: Vec (Vector) Example: Summary Table: Feature struct Vec<T> Purpose Define a custom type with fixed fields Store a variable-length list of elements Members Fields Elements Member Types Can be different Must be the same (T) Size Fixed number of fields (compile-time) Variable…

Read the full article

RUST: enum

Think of an enum as defining a set of named constants that represent all the possible values a type can have. However, Rust enums go beyond simple named constants found in many other languages by allowing variants to hold associated data. Core Concepts: Basic Syntax: Enums with Associated Data: This is where Rust enums really shine.…

Read the full article

RUST: String manipulation

Rust provides a rich set of methods for string manipulation, primarily through the &str (string slice) primitive type and the String (owned, growable string) type from the standard library. Since String implements Deref<Target = str>, most methods available on &str can also be called directly on String. Here’s a comprehensive list, categorized for clarity: I. Creation & Conversion II. Length & Capacity III. Appending &…

Read the full article

RUST: Data Structures

I. Primitive Types (Built-in) These are the fundamental building blocks. II. Compound Types (Built-in) These group other values together. III. Standard Library Collections (std::collections) These are more flexible, often heap-allocated structures. IV. User-Defined Types You define these yourself using keywords. V. Slices (Borrowed Views) This list covers the most commonly encountered data structures. The choice…

Read the full article

"You want a toe? I can get you a toe. There are ways, Dude. You don't wanna know about it, believe me."