.write() is allowed to return after a partial write even if no error occurred. .write_all() wraps a loop which checks the return value of .write() and calls it again if it returned early without an error, else returns the error.
The weirder thing in your code is that you're using BufReader and BufWriter to read into and write from a buffer, which basically just adds more work for no real benefit.