Skip to main content

EvalError

Enum EvalError 

Source
#[non_exhaustive]
pub enum EvalError { Io { path: PathBuf, source: Error, }, Parse { path: PathBuf, reason: &'static str, }, DimensionMismatch { expected: usize, found: usize, }, LengthMismatch { kind: &'static str, expected: usize, found: usize, }, KExceedsCorpus { k: usize, corpus_size: usize, }, EmptyInput { kind: &'static str, }, Search(IqdbError), UnsupportedVectorId { found: &'static str, }, }
Expand description

An error from an iqdb-eval measurement or dataset-loading operation.

Each variant identifies one specific failure. The enum is #[non_exhaustive]: future releases may add variants without it being a breaking change, so a match on it must include a wildcard arm.

§Examples

use iqdb_eval::EvalError;

let err = EvalError::DimensionMismatch { expected: 128, found: 64 };
assert_eq!(
    err.to_string(),
    "vector dimension mismatch: expected 128, found 64",
);

let err = EvalError::KExceedsCorpus { k: 100, corpus_size: 10 };
assert_eq!(
    err.to_string(),
    "k exceeds corpus size: k=100, corpus_size=10",
);

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Io

An OS-level I/O failure occurred while reading a dataset file. path is the file whose read failed; source is the underlying std::io::Error and is reachable via std::error::Error::source.

Fields

§path: PathBuf

The path whose read or open call failed.

§source: Error

The underlying I/O error.

§

Parse

A dataset file was opened successfully but its contents could not be parsed (truncated record, invalid header, etc.). reason is a short static description of the parser check that failed.

Fields

§path: PathBuf

The path of the file whose contents could not be parsed.

§reason: &'static str

Short static description of which parser check failed.

§

DimensionMismatch

A vector did not have the dimensionality the operation required. expected is what was required; found is what was supplied.

Fields

§expected: usize

The dimensionality the operation required.

§found: usize

The dimensionality that was actually supplied.

§

LengthMismatch

Two collections that had to share a length did not. kind names the pair (e.g. "queries vs ground_truth"); expected is the first collection’s length; found is the second’s.

Fields

§kind: &'static str

Short, stable identifier for the collection pair.

§expected: usize

The expected length (typically the first collection’s len()).

§found: usize

The actual length (typically the second collection’s len()).

§

KExceedsCorpus

The requested k exceeds the corpus size, so a k-nearest result cannot be returned.

Fields

§k: usize

The requested top-k count.

§corpus_size: usize

The number of vectors searchable in the index.

§

EmptyInput

A required input collection was empty. kind names the collection (e.g. "queries", "base", "ground_truth").

Fields

§kind: &'static str

Short, stable identifier for the empty input.

§

Search(IqdbError)

A nested IqdbError surfaced from a downstream IndexCore operation (typically iqdb_index::IndexCore::insert or iqdb_index::IndexCore::search).

§

UnsupportedVectorId

A VectorId shape that the harness cannot project to a u32 row-index was encountered while computing ground truth. The convention is documented on crate::build_index_from_base: callers must insert each base row at VectorId::U64(row_index). found is a short static identifier for the variant that was actually returned (for example, "VectorId::Bytes").

Fields

§found: &'static str

Short identifier for the VectorId variant that was returned.

Trait Implementations§

Source§

impl Debug for EvalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for EvalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for EvalError

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl ForgeError for EvalError

Source§

fn kind(&self) -> &'static str

Returns the kind of error, typically matching the enum variant
Source§

fn caption(&self) -> &'static str

Returns a human-readable caption for the error
Source§

fn is_retryable(&self) -> bool

Returns true if the operation can be retried
Source§

fn is_fatal(&self) -> bool

Returns true if the error is fatal and should terminate the program
Source§

fn status_code(&self) -> u16

Returns an appropriate HTTP status code for the error
Source§

fn exit_code(&self) -> i32

Returns an appropriate process exit code for the error
Source§

fn user_message(&self) -> String

Returns a user-facing message that can be shown to end users
Source§

fn dev_message(&self) -> String

Returns a detailed technical message for developers/logs
Source§

fn backtrace(&self) -> Option<&Backtrace>

Returns a backtrace if available
Source§

fn register(&self)

Registers the error with the central error registry
Source§

impl From<IqdbError> for EvalError

Source§

fn from(value: IqdbError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ForgeErrorRecovery for T
where T: ForgeError,

Source§

fn create_retry_policy(&self, max_retries: usize) -> RetryPolicy

Create a retry policy optimized for this error type
Source§

fn retry<F, T, E>(&self, max_retries: usize, operation: F) -> Result<T, E>
where F: FnMut() -> Result<T, E>, E: ForgeError,

Execute a fallible operation with retries if this error type is retryable
Source§

fn create_circuit_breaker(&self, name: impl Into<String>) -> CircuitBreaker

Create a circuit breaker for operations that might result in this error type
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<E> WithErrorCode<E> for E

Source§

fn with_code(self, code: impl Into<String>) -> CodedError<E>

Attach an error code to an error
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more