std::io::Write.write() takes a mutable reference to self. My method bypass_nonmmut() only provides a non-mutable reference to the object owning the File instance, which should make it impossible to call write() on it. Yet using the (&self.file) trick I can call it regardless.
Rust references are primarily about being shared vs exclusive.
Mutability is only a secondary effect (&mut isn't a great name because of that, it should have been something like &excl). For example, atomic numbers can be mutated via shared reference. Types with interior mutability can be mutated via shared reference. &File can be written to, because the OS supports shared access.
Ahhh that makes sense. Files are safe to access concurrently, so there is no reason to limit their access to be unique. The Write and Read interfaces mandate a unique reference, but implementing them on &File provides a way to perform concurrent access anyway through a zero-cost indirection.