Created
February 2, 2022 16:15
-
-
Save lu-zero/a10d3da55a006d291c9d2019058d0236 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Error<T> { | |
.. | |
Again(T), | |
} | |
fn send<T: AsRef<[u8]>>(buf: T, ...) -> Result<(), Error<T>> { ... } | |
let mut buf = ...; | |
loop { | |
match send(buf, ...) { | |
Ok(()) => buf = get_new_buf(), | |
Err(Error::Again(b)) => buf = b, | |
Err(e) => return Err(e), | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment