pub enum ComputeError {
DivisionByZero,
UndefinedVariable {
name: String,
},
Overflow,
UnsupportedOperation {
operation: String,
},
DomainError {
message: String,
},
DimensionMismatch {
message: String,
},
SingularMatrix,
ConvergenceFailure {
message: String,
},
Timeout,
OutOfMemory,
Cancelled,
}Expand description
计算错误
Variants§
DivisionByZero
除零错误
UndefinedVariable
未定义变量
Overflow
数值溢出
UnsupportedOperation
不支持的运算
DomainError
域错误(如负数的平方根)
DimensionMismatch
矩阵维度不匹配
SingularMatrix
奇异矩阵(不可逆)
ConvergenceFailure
收敛失败
Timeout
超时错误
OutOfMemory
内存不足
Cancelled
用户取消
Implementations§
Source§impl ComputeError
impl ComputeError
Sourcepub fn undefined_variable(name: impl Into<String>) -> Self
pub fn undefined_variable(name: impl Into<String>) -> Self
创建未定义变量错误
Sourcepub fn unsupported_operation(operation: impl Into<String>) -> Self
pub fn unsupported_operation(operation: impl Into<String>) -> Self
创建不支持的运算错误
Sourcepub fn domain_error(message: impl Into<String>) -> Self
pub fn domain_error(message: impl Into<String>) -> Self
创建域错误
Sourcepub fn dimension_mismatch(message: impl Into<String>) -> Self
pub fn dimension_mismatch(message: impl Into<String>) -> Self
创建维度不匹配错误
Sourcepub fn convergence_failure(message: impl Into<String>) -> Self
pub fn convergence_failure(message: impl Into<String>) -> Self
创建收敛失败错误
Sourcepub fn user_friendly_message(&self) -> String
pub fn user_friendly_message(&self) -> String
获取用户友好的错误消息
Sourcepub fn suggestions(&self) -> Vec<String>
pub fn suggestions(&self) -> Vec<String>
获取修复建议
Sourcepub fn severity(&self) -> ErrorSeverity
pub fn severity(&self) -> ErrorSeverity
获取错误的严重程度
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
检查错误是否可以恢复
Trait Implementations§
Source§impl Clone for ComputeError
impl Clone for ComputeError
Source§fn clone(&self) -> ComputeError
fn clone(&self) -> ComputeError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ComputeError
impl Debug for ComputeError
Source§impl Display for ComputeError
impl Display for ComputeError
Source§impl Error for ComputeError
impl Error for ComputeError
1.30.0 · 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()
Source§impl From<ComputeError> for NotebookError
impl From<ComputeError> for NotebookError
Source§fn from(source: ComputeError) -> Self
fn from(source: ComputeError) -> Self
Converts to this type from the input type.
Source§impl From<ComputeError> for YufmathError
impl From<ComputeError> for YufmathError
Source§fn from(source: ComputeError) -> Self
fn from(source: ComputeError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ComputeError
impl PartialEq for ComputeError
impl StructuralPartialEq for ComputeError
Auto Trait Implementations§
impl Freeze for ComputeError
impl RefUnwindSafe for ComputeError
impl Send for ComputeError
impl Sync for ComputeError
impl Unpin for ComputeError
impl UnwindSafe for ComputeError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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