Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-rs latest

ScopeError.into_value

Take the value the operation produced before cleanup failed.

Source and package
Qualified name
libtmux::error::scoped::ScopeError::into_value
Module
error.scoped
Declared in
ScopeError
Package
libtmux
Source
crates/libtmux/src/error/scoped.rs
impl<T, E> ScopeError<T, E> pub fn into_value(self) -> Option<T>

Description#

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(),
};
Type parameters
Esc

Type to search.

Reference previewOpen reference