π¦ Rustacean at Heart
- π I'm a Computer Science and Information Engineering student.
- π§΅ Passionate about system-level programming.
- π‘ I believe in learning by doing, sharing, and breaking things to build better ones.
- β‘ Fun fact: The value is immutable. Just like that one conversation you shouldβve ended.
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
-
π§ My email
mellivorandy [at] gmail [dot] com
π Fun bits
It compiled. The borrow checker approved. But she never ran the binary.
π
Even the borrow checker canβt protect a heart from a dangling lifetime. Love, like memory, is best borrowed β but only if it lives long enough. For affection is a reference: safe, valid, but never owned. And like any borrow, it only lasts as long as the lifetime holds.use std::fmt;
struct Heart<'a> {
memory: &'a str,
}
fn main() {
let confession = String::from("I like you, but I can't express it safely...");
let safe_love = Heart { memory: &confession };
// drop(confession); // error[E0505]: cannot move out of `confession` because it is borrowed
println!("π Love is safe: {}", safe_love.memory);
println!("π¦ Segfaultless in Kaohsiung. Thanks, borrow checker.");
}
impl fmt::Display for Heart<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.memory)
}
}
-
Icons used in this README are provided by Devicon. Huge thanks to the Devicon team for their incredible work on this amazing open-source project!
-
External links point to official websites of the respective technologies for learning or attribution purposes.
-
All trademarks, logos, and brand names used remain the property of their respective owners.