Skip to content

Commit

Permalink
Refactor interpolation modules and update CI workflow
Browse files Browse the repository at this point in the history
Moved `Value` trait implementation for f32 and f64 to `value.rs` from `spline.rs`. Simplified the usage example in `linear.rs`. Updated CI workflow to use a dedicated action for installing 'nextest' and added a step for running documentation tests.
  • Loading branch information
nakashima-hikaru committed Jun 15, 2024
1 parent ed8e078 commit de1acf8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Install nextest
shell: bash
run: |
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- uses: taiki-e/install-action@nextest
- run: cargo fmt --all --check
- run: cargo check --workspace
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo nextest run -E 'all() - package(calendar)'
- run: cargo nextest run -E 'all() - package(calendar)'
- run: cargo test --doc
5 changes: 1 addition & 4 deletions crates/qlab-math/src/interpolation/linear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ use qlab_error::InterpolationError;
/// use qlab_math::interpolation::linear::Linear;
/// use qlab_math::interpolation::Interpolator;
///
/// let mut linear: Linear<f32> = Linear::default();
///
/// let xs_and_ys: [(f32, f32); 2] = [(1.0_f32, 2.0_f32), (3.0_f32, 4.0_f32)];
///
/// linear.try_fit(&xs_and_ys).unwrap();
/// let linear = Linear::default().try_fit(&xs_and_ys).unwrap();
/// assert_eq!(linear.try_value(2.0).unwrap(), 3.0);
///
/// ```
Expand Down
4 changes: 0 additions & 4 deletions crates/qlab-math/src/interpolation/spline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ use crate::value::Value;
pub mod catmull_rom;
pub mod hermite;
pub mod natural_cubic;

impl Value for f32 {}

impl Value for f64 {}
4 changes: 4 additions & 0 deletions crates/qlab-math/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ pub trait Value:
+ Default
{
}

impl Value for f32 {}

impl Value for f64 {}

0 comments on commit de1acf8

Please sign in to comment.