Skip to content

Conversation

@SpookyYomo
Copy link
Contributor

@SpookyYomo SpookyYomo commented Mar 16, 2025

As discussed from #53, we begin the migration by first introducing the -core crate.
By using the version number as being 0.0.0, we show strictly that it's meant to be a internal crate.

I believe we can start defining the common traits necessary on non-NAN floats, integers etc here too. I am not sure at present if this conflicts with the internal crate requirement.

Currently just providing a minimal set of Error enums as cherry-picked, with non-allocating variants.
The fmt::Display for the error and a README.md is to be decided in the future.

Edit:
The results as shown in #78 and #86 might show that the current Errors might be strictly insufficient are require more thought. It might be worth seriously considering anyhow.


Note

Introduce new sci-rs-core crate with no_std-ready core error types, feature gates, and base deps.

  • Core crate: Add sci-rs-core with no_std support and feature flags.
    • Features: alloc (default), std (enables alloc).
    • Metadata: docs.rs all-features = true.
    • Deps: ndarray, ndarray-conv, num-traits (minimal default features).
  • Error handling:
    • New Error enum with InvalidArg and ConflictArg variants.
      • Allocating variants (with String) under alloc.
      • Non-alloc fallbacks without payloads when alloc is disabled.
    • fmt::Display and core::error::Error impls with conditional messaging.
    • Result<T> type alias to core::result::Result<T, Error>.
  • Files:
    • sci-rs-core/Cargo.toml
    • sci-rs-core/src/lib.rs

Written by Cursor Bugbot for commit f21a6bc. This will update automatically on new commits. Configure here.

The error variants here should guide the user as to the wrong use of
functions, instead of taking down the entire program with a panic, which
is especially necessary in an embedded environment.
This however does not specify to the end user which arguments are
raising the error.

Fix "Conflict" typo in Error enum variant
@SpookyYomo SpookyYomo requested a review from trueb2 as a code owner March 16, 2025 23:42
@SpookyYomo SpookyYomo mentioned this pull request Apr 24, 2025
4 tasks
Display trait is for when `main` ends and an error message is shown to
the end user.
@SpookyYomo
Copy link
Contributor Author

Rebased onto new main

@SpookyYomo SpookyYomo mentioned this pull request May 1, 2025
1 task
@SpookyYomo
Copy link
Contributor Author

Perhaps some error conventions and things to consider as this develops into the future: https://sabrinajewson.org/blog/errors

This version of ndarray-conv accounts for both cross-correlation and
convolution.
cursor[bot]

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant