pub enum ADRuleError {
Unsupported {
op: String,
rule: ADRuleKind,
},
}Expand description
Error returned when an AD rule cannot be emitted.
§Examples
use tidu::{ADRuleError, ADRuleKind};
let err = ADRuleError::unsupported("my_crate::fft", ADRuleKind::Jvp);
assert_eq!(err.rule(), ADRuleKind::Jvp);
assert!(err.to_string().contains("my_crate::fft"));Variants§
Unsupported
The requested primitive does not provide the requested AD rule.
Fields
§
rule: ADRuleKindMissing rule kind.
Implementations§
Source§impl ADRuleError
impl ADRuleError
Sourcepub fn unsupported(op: impl Into<String>, rule: ADRuleKind) -> Self
pub fn unsupported(op: impl Into<String>, rule: ADRuleKind) -> Self
Constructs an unsupported-rule error.
§Examples
use tidu::{ADRuleError, ADRuleKind};
let err = ADRuleError::unsupported("custom::op", ADRuleKind::Transpose);
assert_eq!(err.rule(), ADRuleKind::Transpose);Sourcepub const fn rule(&self) -> ADRuleKind
pub const fn rule(&self) -> ADRuleKind
Returns the AD rule kind associated with this error.
§Examples
use tidu::{ADRuleError, ADRuleKind};
let err = ADRuleError::unsupported("custom::op", ADRuleKind::Jvp);
assert_eq!(err.rule(), ADRuleKind::Jvp);Trait Implementations§
Source§impl Clone for ADRuleError
impl Clone for ADRuleError
Source§fn clone(&self) -> ADRuleError
fn clone(&self) -> ADRuleError
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 ADRuleError
impl Debug for ADRuleError
Source§impl Display for ADRuleError
impl Display for ADRuleError
Source§impl Error for ADRuleError
impl Error for ADRuleError
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 PartialEq for ADRuleError
impl PartialEq for ADRuleError
impl Eq for ADRuleError
impl StructuralPartialEq for ADRuleError
Auto Trait Implementations§
impl Freeze for ADRuleError
impl RefUnwindSafe for ADRuleError
impl Send for ADRuleError
impl Sync for ADRuleError
impl Unpin for ADRuleError
impl UnsafeUnpin for ADRuleError
impl UnwindSafe for ADRuleError
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