async-readline
async-readline copied to clipboard
refactor: if let .. else .. to match statement
This pull request changes the if let {} else {} statements to match, which seems a bit more rustified. If there is no else branch, if let is a nice shorthand though.
Also, I removed the todo comment is 0 is EOF. If you look at https://doc.rust-lang.org/std/io/trait.Read.html#tymethod.read, that is exactly the case.
So the EOF thing is about ending the Stream (by returning None) on ret == 0 . Plus on Ctrl+D or something like it. Right now it's necessary to kill demo to fnish it.