pub enum ExtensionLoweringError {
Message {
message: String,
kind: ErrorKind,
},
Source {
kind: ErrorKind,
source: Box<dyn StdError + Send + Sync + 'static>,
},
}Expand description
Error returned when an extension cannot expand itself into standard ops.
§Examples
use tenferro_ops::ext_op::ExtensionLoweringError;
let err = ExtensionLoweringError::new("example extension cannot lower");
assert!(err.to_string().contains("cannot lower"));Variants§
Message
A lowering failure that has no typed source.
Fields
Source
A lowering failure retaining the domain source that caused it.
Implementations§
Source§impl ExtensionLoweringError
impl ExtensionLoweringError
Sourcepub fn new(message: impl Into<String>) -> Self
pub fn new(message: impl Into<String>) -> Self
Create a lowering error with a human-readable diagnostic.
§Examples
use tenferro_ops::ext_op::ExtensionLoweringError;
let err = ExtensionLoweringError::new("shape must be static");
assert_eq!(err.to_string(), "shape must be static");Sourcepub fn new_with_kind(kind: ErrorKind, message: impl Into<String>) -> Self
pub fn new_with_kind(kind: ErrorKind, message: impl Into<String>) -> Self
Create a lowering error with an explicit coarse classification.
§Examples
use tenferro_ops::ext_op::ExtensionLoweringError;
use tenferro_tensor::ErrorKind;
let err = ExtensionLoweringError::new_with_kind(
ErrorKind::Unsupported,
"extension is not supported by this lowering target",
);
assert_eq!(err.kind(), ErrorKind::Unsupported);Sourcepub fn from_source<E>(source: E) -> Self
pub fn from_source<E>(source: E) -> Self
Create a lowering error while retaining a typed source.
§Examples
use std::error::Error as _;
use tenferro_ops::ext_op::ExtensionLoweringError;
let source = std::io::Error::new(std::io::ErrorKind::Other, "shape unavailable");
let err = ExtensionLoweringError::from_source(source);
assert!(err.source().is_some());Sourcepub fn from_source_with_kind<E>(kind: ErrorKind, source: E) -> Self
pub fn from_source_with_kind<E>(kind: ErrorKind, source: E) -> Self
Create a lowering error with a typed source and explicit classification.
§Examples
use tenferro_ops::ext_op::ExtensionLoweringError;
use tenferro_tensor::ErrorKind;
let err = ExtensionLoweringError::from_source_with_kind(
ErrorKind::BackendFailure,
std::io::Error::other("backend rejected lowering"),
);
assert_eq!(err.kind(), ErrorKind::BackendFailure);
assert!(std::error::Error::source(&err).is_some());Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Return the stable classification carried by this lowering failure.
§Examples
use tenferro_ops::ext_op::ExtensionLoweringError;
use tenferro_tensor::ErrorKind;
let error = ExtensionLoweringError::new_with_kind(
ErrorKind::Unsupported,
"target has no lowering",
);
assert_eq!(error.kind(), ErrorKind::Unsupported);Trait Implementations§
Source§impl Debug for ExtensionLoweringError
impl Debug for ExtensionLoweringError
Source§impl Display for ExtensionLoweringError
impl Display for ExtensionLoweringError
Source§impl Error for ExtensionLoweringError
impl Error for ExtensionLoweringError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ExtensionLoweringError
impl !RefUnwindSafe for ExtensionLoweringError
impl Send for ExtensionLoweringError
impl Sync for ExtensionLoweringError
impl Unpin for ExtensionLoweringError
impl UnsafeUnpin for ExtensionLoweringError
impl !UnwindSafe for ExtensionLoweringError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more