Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungWhat is Programming And How i can Enjoy it?(24.09.2026 um 11:54 Uhr)
Sichere ProgrammierungYou Don't Need Adobe Commerce Cloud to Survive Black Friday(24.09.2026 um 11:55 Uhr)
Malware / Trojaner / VirenBeyond Lazarus: Organization of DPRK cyber capabilities(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenBeyond Lazarus: Organization of DPRK Cyber Capabilities(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenThe fake worker threat and the rise of human infiltration(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenPolinRider Spreads Through Compromised GitHub Accounts and Packagist(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenWeaselBiscuit Strips BeaverTail and OtterCookie Down to Essentials(24.09.2026 um 11:59 Uhr)
Sichere ProgrammierungWhat is Programming And How i can Enjoy it?(24.09.2026 um 11:54 Uhr)
Sichere ProgrammierungYou Don't Need Adobe Commerce Cloud to Survive Black Friday(24.09.2026 um 11:55 Uhr)
Malware / Trojaner / VirenBeyond Lazarus: Organization of DPRK cyber capabilities(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenBeyond Lazarus: Organization of DPRK Cyber Capabilities(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenThe fake worker threat and the rise of human infiltration(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenPolinRider Spreads Through Compromised GitHub Accounts and Packagist(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenWeaselBiscuit Strips BeaverTail and OtterCookie Down to Essentials(24.09.2026 um 11:59 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Ownership and Borrowing: My Journey Into Rust’s Unique Memory System

So,I’ve been diving into Rust, and one thing that keeps popping up everywhere is this idea of ownership and borrowing. At first, it felt like Rust was being too strict with me 😅 errors everywhere! But then I realized… these rules are the se…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

So,I’ve been diving into Rust, and one thing that keeps popping up everywhere is this idea of ownership and borrowing.

At first, it felt like Rust was being too strict with me 😅 errors everywhere! But then I realized… these rules are the secret sauce that make Rust memory safe without a garbage collector.



I tried to note down the important rules (12 of them) that I keep in mind while coding, along with examples. Writing them out helps me remember and maybe it’ll help you too if you’re learning like me.




🦀 Rule 1: Every value has exactly one owner
fn main() {
let s = String::from("hello");
println!("{}", s); // s owns "hello"
}






The variable s owns the string. Simple start.




🦀 Rule 2: When the owner goes out of scope, the value is dropped
fn main() {
{
let s = String::from("hello");
} // s goes out of scope -> memory freed automatically
}






No free() needed. Rust does it for us.




🦀 Rule 3: Assigning moves ownership
fn main() {
let s1 = String::from("hello");
let s2 = s1; // ownership moved
// println!("{}", s1); // ❌ error: s1 not valid anymore
}






This was one of the first “gotchas” for me. After s1 moves, it’s gone.




🦀 Rule 4: Clone makes a deep copy
fn main() {
let s1 = String::from("hello");
let s2 = s1.clone();
println!("{} and {}", s1, s2); // ✅ both valid
}







So if I really need two separate copies, I clone.




🦀 Rule 5: Primitives are Copy
fn main() {
let x = 10;
let y = x; // just copied
println!("{} and {}", x, y); // ✅ works fine
}






This explains why integers never gave me move errors 😅.




🦀 Rule 6: Borrow with &
fn main() {
let s = String::from("hello");
print_length(&s); // borrow, no move
println!("Still valid: {}", s); // ✅
}

fn print_length(s: &String) {
println!("Length: {}", s.len());
}






Here, ownership stays with s, but the function can still read it.




🦀 Rule 7: Mutable references need &mut
fn main() {
let mut s = String::from("hello");
change(&mut s);
println!("{}", s); // "hello world"
}

fn change(s: &mut String) {
s.push_str(" world");
}






The first time I used &mut, it clicked borrowing but with permission to change.




🦀 Rule 8: Only one mutable reference at a time
fn main() {
let mut s = String::from("hello");
let r1 = &mut s;
// let r2 = &mut s; // ❌ not allowed
println!("{}", r1);
}







Rust says: “No data races allowed here.”




🦀 Rule 9: Multiple immutable references are fine
fn main() {
let s = String::from("hello");
let r1 = &s;
let r2 = &s;
println!("{} and {}", r1, r2); // ✅ works
}







This makes sense if nobody’s changing it, multiple readers are fine.




🦀 Rule 10: But you can’t mix mutable and immutable references
fn main() {
let mut s = String::from("hello");
let r1 = &s;
let r2 = &s;
// let r3 = &mut s; // ❌ clash
println!("{} and {}", r1, r2);
}






Took me a while to accept this. Rust protects me even from myself.




🦀 Rule 11: References must always be valid
fn main() {
let r;
{
let s = String::from("hello");
r = &s;
}
// println!("{}", r); // ❌ dangling reference
}






This is what other languages sometimes allow… but leads to bugs. Rust just stops me.



🦀 Rule 12: These rules together = safety



At first these rules feel like handcuffs. But the more I code, the more I see the benefits:



No null pointers

No dangling references

No data races in multi-threaded code

And all of this checked at compile time.



🎯 My Takeaway

I used to fight with the borrow checker, but now I think of it as a teacher. The compiler forces me to think about ownership. And honestly, that’s making me a better programmer.



I’m still learning, but these 12 rules are like my “cheat sheet” for Rust’s ownership model. Hopefully this helps someone else who’s starting out too 🙌.

SOC Incident Playbook: Remote Code Execution (RCE) Defense
title: Detect Exploitation - Ownership and Borrowing: My Journey Into Rust’s Unique Memory System
id: 6dc185aa-2bf3-4fed-afba-a1097d88bbd1
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Ownership and Borrowing: My Jo" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Ownership and Borrowing: My Journey Into.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Ownership and Borrowing: My Journey Into Rust’s Unique Memory System

Thematisch verwandte Begriffe: Ownership, Borrowing, Journey, Into · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-97152 | Nanomsg versions 0.5-beta through 1.x before 1.2.3 has a remotely exploi…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick