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

error.scoped.ScopeError

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

View as Markdown

Module
error.scoped
Package
libtmux
Source
crates/libtmux/src/error/scoped.rs
enum error.scoped.ScopeError
enumoverload [source]
enumoverload [source]
enum error.scoped.ScopeError

A scoped resource's creation, operation, or cleanup failure.

Returned by crate::Server::with_session , crate::Session::with_window , and crate::Window::with_pane . The operation error keeps its original type and value, with no `From<Error>requirement. Cleanup failures retain because creation succeeded; an operation error alone makes no replay guarantee. retains the operation's own result too: it already computedTwhen cleanup failed, and matching the variant is the only way to reach it, since the outerResult is Err` either way.

Debug, Display, and std::error::Error are implemented for every T and E, but each only shows a value when its type supports it: Debug needs T: Debug and E: Debug, Display needs E: Display, and Error needs both, since it requires them as supertraits. A caller whose types have neither still gets a working scope: both values remain reachable by matching the variant, and creation and cleanup failures format and chain regardless.

std::error::Error::source exposes the cleanup error in Self::Cleanup and Self::OperationAndCleanup , and the creation error in Self::Creation . It never exposes the operation error: E need not implement std::error::Error at all, so there is no &(dyn Error + 'static) to hand back even when Display can show it. Match the variant to reach it directly.

Examples

use libtmux::ScopeError;
let guard = libtmux::test::TestServer::new().await?;
let outcome = guard.server().with_session("work", async |_session| {
Err::<(), _>("operation failed")
}).await;
assert!(matches!(outcome, Err(ScopeError::Operation("operation failed"))));
guard.shutdown().await?;

7 declared, 0 inherited

Members

  • into_operation method Take the operation's own error, when the operation is what failed.
  • into_value method Take the value the operation produced before cleanup failed.
  • tmux_error method Borrow the tmux error from creation or cleanup.
  • Cleanup constant The operation succeeded, but cleanup failed after creation.
  • Creation constant The resource could not be created; the operation did not run.
  • Operation constant The operation failed and cleanup succeeded.
  • OperationAndCleanup constant The operation and cleanup both failed.
Esc

Type to search.