server.Server.with_session
Rust
- Python Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- server
- Declared in
- Server
- Package
- libtmux
- Source
- crates/libtmux/src/server.rs
- with_session ( self , options : impl Into<NewSessionOptions> , operation : impl AsyncFnOnce(&Session) -> Result<T, E> ) Result<T, crate::ScopeError<T, E>>
-
Create a session, run an operation with it, then kill it.
crate::ScopeErrorretains creation, operation and cleanup failures separately. If operation and cleanup both fail, both original errors are returned. Cleanup errors carryError::AfterEffectbecause creation succeeded.Errors
Returns
crate::ScopeErrorwhen creation, the operation, or cleanup fails. The operation's error needs no conversion intoError.Cancel safety
Nothing is left behind. Once polled, creation and cleanup run in tasks of their own, so the session is killed even if this future is dropped or the operation panics, while the Tokio runtime is alive. A cleanup failure then has no caller to reach; the
tracingfeature records it.
0 declared, 0 inherited