Debian Codegraph @

src/exec/io_util.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/;
2
3 /// Return `true` if the IO error is an interruption.
4 pub(superrust-analyzer cargo sudo-rs 0.2.14 exec/) fn was_interruptedrust-analyzer cargo sudo-rs 0.2.14 exec/io_util/was_interrupted().(err: &iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> bool {
5 // ogsudo checks against `EINTR` and `EAGAIN`.
6 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(
7 err.kindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]kind().(),
8 iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::Interruptedrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#Interrupted# | iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::WouldBlockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#WouldBlock#
9 )
10 }
11
12 /// Call `f` repeatedly until it succeeds or it encounters a non-interruption error.
13 pub(superrust-analyzer cargo sudo-rs 0.2.14 exec/) fn retry_while_interruptedrust-analyzer cargo sudo-rs 0.2.14 exec/io_util/retry_while_interrupted().<T>(mut f: impl FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#() -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<T>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<T> {
14 loop {
15 match f() {
16 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) if was_interruptedrust-analyzer cargo sudo-rs 0.2.14 exec/io_util/was_interrupted().(&err) => {}
17 result => return result,
18 }
19 }
20 }