pub struct ShapeGuardFailure { /* private fields */ }Expand description
Error returned by a shape-guard metadata query.
The public ShapeGuardError remains the typed source. The private side
channel is shared with the owning ShapeGuardContext so an external
message-only AD callback can report the same typed source at the runtime
boundary without changing the callback protocol.
§Examples
use computegraph::types::{ValueKey, ValueRef};
use tenferro_ops::input_key::TensorInputKey;
use tenferro_ops::std_tensor_op::StdTensorOp;
use tenferro_ops::{ShapeGuardContext, ShapeGuardError};
let key = ValueKey::<StdTensorOp>::Input(TensorInputKey::User { id: 8 });
let value = ValueRef::External(key);
let mut ctx = ShapeGuardContext::default();
let failure = ctx.shape_of(&value).unwrap_err();
assert!(matches!(
failure.typed_source(),
ShapeGuardError::MissingMetadata { .. }
));Implementations§
Source§impl ShapeGuardFailure
impl ShapeGuardFailure
Sourcepub fn typed_source(&self) -> &ShapeGuardError
pub fn typed_source(&self) -> &ShapeGuardError
Return the original typed shape-guard failure.
Sourcepub fn into_typed_source(self) -> ShapeGuardError
pub fn into_typed_source(self) -> ShapeGuardError
Consume this boundary error and return its original typed failure.
Trait Implementations§
Source§impl Clone for ShapeGuardFailure
impl Clone for ShapeGuardFailure
Source§fn clone(&self) -> ShapeGuardFailure
fn clone(&self) -> ShapeGuardFailure
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ShapeGuardFailure
impl Debug for ShapeGuardFailure
Source§impl Display for ShapeGuardFailure
impl Display for ShapeGuardFailure
Source§impl Error for ShapeGuardFailure
impl Error for ShapeGuardFailure
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<ShapeGuardFailure> for ADRuleError
Available on crate feature autodiff only.
impl From<ShapeGuardFailure> for ADRuleError
Available on crate feature
autodiff only.Source§fn from(err: ShapeGuardFailure) -> Self
fn from(err: ShapeGuardFailure) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ShapeGuardFailure
impl PartialEq for ShapeGuardFailure
impl Eq for ShapeGuardFailure
Auto Trait Implementations§
impl Freeze for ShapeGuardFailure
impl !RefUnwindSafe for ShapeGuardFailure
impl Send for ShapeGuardFailure
impl Sync for ShapeGuardFailure
impl Unpin for ShapeGuardFailure
impl UnsafeUnpin for ShapeGuardFailure
impl !UnwindSafe for ShapeGuardFailure
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