#[non_exhaustive]pub enum SessionEntryError {
Reentered {
backend: &'static str,
},
Contended {
backend: &'static str,
message: String,
},
IncompatibleContext {
backend: &'static str,
message: String,
},
ResourcePoisoned {
backend: &'static str,
resource: &'static str,
},
Executor {
backend: &'static str,
source: BoxError,
},
}Expand description
Why a backend refused to open an execution session.
The session callback has not run when this error is returned. Contention that the backend can wait out (another thread holding an overlapping CPU resource permit) is waited for, not reported; this type covers only states that waiting cannot resolve.
§Examples
use tenferro_tensor::{Error, ErrorKind, SessionEntryError};
let entry = SessionEntryError::IncompatibleContext {
backend: "CpuBackend",
message: "operation backend does not match the active execution scope".into(),
};
let error = Error::from(entry);
assert_eq!(error.kind(), ErrorKind::RuntimeState);
assert!(std::error::Error::source(&error).is_some());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Reentered
An execution for this backend is already active on the calling thread (or its managed worker scope), so opening another session would nest provider or resource exclusion.
Contended
A resource that admission cannot wait for is held by another user, such as a caller-managed CPU domain already executing elsewhere.
Fields
IncompatibleContext
The session cannot be opened in the declared or active execution context, for example an execution scope entered for a different backend.
Fields
ResourcePoisoned
Admission state was poisoned by an earlier panic and cannot be trusted.
Fields
Executor
The backend’s executor could not be entered.
Implementations§
Source§impl SessionEntryError
impl SessionEntryError
Sourcepub fn backend(&self) -> &'static str
pub fn backend(&self) -> &'static str
Return the backend that rejected the session entry.
§Examples
use tenferro_tensor::SessionEntryError;
let error = SessionEntryError::ResourcePoisoned {
backend: "CpuBackend",
resource: "the CPU resource arbiter",
};
assert_eq!(error.backend(), "CpuBackend");Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Return the coarse classification of this failure.
Every session-entry failure is invalid or unavailable execution state.
§Examples
use tenferro_tensor::{ErrorKind, SessionEntryError};
let error = SessionEntryError::Contended {
backend: "CpuBackend",
message: "caller-managed CPU domain".into(),
};
assert_eq!(error.kind(), ErrorKind::RuntimeState);Trait Implementations§
Source§impl Debug for SessionEntryError
impl Debug for SessionEntryError
Source§impl Display for SessionEntryError
impl Display for SessionEntryError
Source§impl Error for SessionEntryError
impl Error for SessionEntryError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()