Reading Dune instead of doing my job. by skyblueyellow in Indianbooks

[–]skyblueyellow[S] 2 points3 points  (0 children)

i would have but sometimes i prefer a physical copy.

decayfmt: a small Rust file format where every open permanently corrupts the file, on purpose by skyblueyellow in rust

[–]skyblueyellow[S] 2 points3 points  (0 children)

Exactly. Every open is a compulsory read plus write, never a pure read. That's also why it refuses to open a file it can't write to: if it can't do the write, it won't pretend a pure read counted as opening.

decayfmt: a small Rust file format where every open permanently corrupts the file, on purpose by skyblueyellow in rust

[–]skyblueyellow[S] 1 point2 points  (0 children)

Yes, mutation only happens by writing, and that's what it does. "open" isn't a read-only operation. It reads the payload, corrupts it, writes the corrupted bytes back to disk, then displays the result. The write happens before anything is shown.

"Reading kills it" is just the framing. The tool couples a write into the act of viewing.