Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

error.scoped.ScopeError.into_value

Rust
  • Python Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
error.scoped
Declared in
ScopeError
Package
libtmux
Source
crates/libtmux/src/error/scoped.rs
into_value ( self ) → Option<T>
method [source]
method [source]
into_value

Take the value the operation produced before cleanup failed.

None unless the operation succeeded, which is the one case where a result would otherwise be lost: the outer Result is Err either way.

Examples

// The work is done even when tearing the session down failed, so the
// value is worth keeping rather than discarding with the error.
let outcome = server
.with_session("build", async |session| {
Ok::<_, libtmux::Error>(session.id().to_string())
})
.await;
let id = match outcome {
Ok(id) => Some(id),
Err(error) => error.into_value(),
};

0 declared, 0 inherited

Esc

Type to search.