this post was submitted on 13 Aug 2025
525 points (98.0% liked)
Programmer Humor
25671 readers
1980 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm trying to come up with a good pun how ownership and safety could have prevented this but..
use std::sync::OnceLock;
#[derive(Debug)] struct BrainCell { in_use: bool, }
static BRAIN_CELL: OnceLock = OnceLock::new();
fn get_brain_cell() -> &'static BrainCell { BRAIN_CELL.get_or_init(|| { println!("Allocating brain power... this might take a while."); BrainCell { in_use: true } }) }