pub struct ShapeMismatchContext { /* private fields */ }Expand description
Diagnostic context attached to shape-mismatch errors.
This struct provides a builder-style API for constructing
descriptive FerroError::ShapeMismatch errors.
§Examples
use ferrolearn_core::error::ShapeMismatchContext;
let ctx = ShapeMismatchContext::new("predict input")
.expected(&[100, 10])
.actual(&[100, 5]);
let err = ctx.build();
assert!(err.to_string().contains("predict input"));Implementations§
Source§impl ShapeMismatchContext
impl ShapeMismatchContext
Sourcepub fn new(context: impl Into<String>) -> Self
pub fn new(context: impl Into<String>) -> Self
Create a new context with the given description.
Sourcepub fn build(self) -> FerroError
pub fn build(self) -> FerroError
Build the FerroError::ShapeMismatch error.
Trait Implementations§
Source§impl Clone for ShapeMismatchContext
impl Clone for ShapeMismatchContext
Source§fn clone(&self) -> ShapeMismatchContext
fn clone(&self) -> ShapeMismatchContext
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 ShapeMismatchContext
impl Debug for ShapeMismatchContext
Auto Trait Implementations§
impl Freeze for ShapeMismatchContext
impl RefUnwindSafe for ShapeMismatchContext
impl Send for ShapeMismatchContext
impl Sync for ShapeMismatchContext
impl Unpin for ShapeMismatchContext
impl UnsafeUnpin for ShapeMismatchContext
impl UnwindSafe for ShapeMismatchContext
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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