Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 14 additions & 30 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ on:
description: "Choose which toolchain to test (stable, nightly, all)"
required: true
type: choice
options:
- stable
- nightly
- all
options: [stable, nightly, all]

env:
CARGO_TERM_COLOR: always
Expand All @@ -45,12 +42,8 @@ jobs:
target: [x86_64-unknown-linux-gnu]
toolchain: [stable]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
repository: ${{ github.repository }}
ref: ${{ github.ref }}
token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v6
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand All @@ -61,7 +54,7 @@ jobs:
- name: Build the workspace
run: cargo build -r --locked --workspace --features full --target ${{ matrix.target }}
test:
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.toolchain != 'nightly') || true
if: github.event_name != 'workflow_dispatch' || github.event.inputs.toolchain != 'nightly'
needs: build
runs-on: ubuntu-latest
strategy:
Expand All @@ -70,26 +63,23 @@ jobs:
features: [full, default]
target: [x86_64-unknown-linux-gnu]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
repository: ${{ github.repository }}
ref: ${{ github.ref }}
token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v6
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
target: ${{ matrix.target }}
toolchain: stable
override: true
- name: Test (default)
if: matrix.features == 'default'
run: cargo test -r --locked --workspace --target ${{ matrix.target}}
- name: Test (${{ matrix.features }})
if: matrix.features != 'default'
run: cargo test -r --locked --workspace --target ${{ matrix.target}} --features ${{ matrix.features }}
test_nightly:
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.toolchain != 'stable') || true
continue-on-error: true
if: github.event_name != 'workflow_dispatch' || github.event.inputs.toolchain != 'stable'
needs: build
runs-on: ubuntu-latest
strategy:
Expand All @@ -99,15 +89,9 @@ jobs:
- all
- no_std
- "alloc,nightly"
package:
- rspace-traits
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
repository: ${{ github.repository }}
ref: ${{ github.ref }}
token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v6
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand All @@ -116,16 +100,16 @@ jobs:
override: true
- name: Test (all-features)
if: matrix.features == 'all'
run: cargo test -r --locked --all-features --package ${{ matrix.package }}
run: cargo test -r --locked --all-features --workspace
- name: Test (no_std)
continue-on-error: true
if: matrix.features == 'no_std'
run: cargo test -r --locked --no-default-features --package ${{ matrix.package }}
run: cargo test -r --locked --no-default-features --workspace
env:
RUSTFLAGS: "-C panic=abort -Z panic_abort_tests"
- name: Test (${{ matrix.features }})
continue-on-error: true
if: matrix.features != 'all' && matrix.features != 'no_std'
run: cargo test -r --locked --no-default-features --features ${{ matrix.features }} --package ${{ matrix.package }}
run: cargo test -r --locked --no-default-features --features ${{ matrix.features }} --workspace
env:
RUSTFLAGS: "-C panic=abort -Z panic_abort_tests"
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/FL03/rspace.git"
rust-version = "1.85.0"
version = "0.0.8"
version = "0.0.9"

[workspace.dependencies]
rspace = { default-features = false, path = "rspace", version = "0.0.8" }
rspace-core = { default-features = false, path = "core", version = "0.0.8" }
rspace-traits = { default-features = false, path = "traits", version = "0.0.8" }
rspace = { default-features = false, path = "rspace", version = "0.0.9" }
rspace-core = { default-features = false, path = "core", version = "0.0.9" }
rspace-traits = { default-features = false, path = "traits", version = "0.0.9" }
# development & benchmarking
criterion = { version = "0.8" }
# data structures
Expand Down
File renamed without changes.
9 changes: 2 additions & 7 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@
Appellation: core <library>
Contrib: FL03 <jo3mccain@icloud.com>
*/
//! this core components of the contained crate
//! this modules defines the core pimitives and utilities for `rspace`
#![allow(
clippy::missing_safety_doc,
clippy::module_inception,
clippy::needless_doctest_main,
clippy::upper_case_acronyms
)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "nightly", feature(allocator_api))]
// compiler checks
#[cfg(not(any(feature = "std", feature = "alloc")))]
compile_error! {
"Either the 'std' or 'alloc' feature must be enabled."
}
#![cfg_attr(all(feature = "alloc", feature = "nightly"), feature(allocator_api))]
// external crates
#[cfg(feature = "alloc")]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let
};

common = {
version = "0.0.8";
version = "0.0.9";
src = self;

cargoLock = {
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
in rec {
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "rspace";
version = "0.0.8";
version = "0.0.9";
src = self; # ./.;
cargoLock = {
lockFile = ./Cargo.lock;
Expand Down
6 changes: 2 additions & 4 deletions rspace/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
clippy::upper_case_acronyms
)]
#![cfg_attr(not(feature = "std"), no_std)]
// compiler check
#[cfg(not(any(feature = "std", feature = "alloc")))]
compile_error! { "either the \"std\" or \"alloc\" feature must be enabled" }
#![cfg_attr(all(feature = "alloc", feature = "nightly"), feature(allocator_api))]
// external crates
#[cfg(any(feature = "alloc", feature = "std"))]
#[cfg(feature = "alloc")]
extern crate alloc;
// declare external crates as modules
#[doc(inline)]
Expand Down
20 changes: 11 additions & 9 deletions traits/src/impls/impl_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,29 +83,30 @@ mod impl_alloc {
use alloc::alloc::Allocator;
use alloc::vec::Vec;

impl<U, V, A, F> MapInto<F, V> for Vec<U, A>
impl<F, X, Y, A> MapInto<F, Y> for Vec<X, A>
where
A: Allocator,
F: FnMut(U) -> V,
Vec<V, A>: FromIterator<V>,
F: FnMut(X) -> Y,
Vec<Y, A>: FromIterator<Y>,
{
type Cont<_T> = Vec<_T, A>;
type Elem = U;
type Elem = X;

fn apply(self, f: F) -> Self::Cont<V> {
fn apply(self, f: F) -> Self::Cont<Y> {
self.into_iter().map(f).collect()
}
}

impl<'a, U, V, A, F> MapTo<F, V> for &'a Vec<U, A>
impl<'a, F, X, Y, A> MapTo<F, Y> for &'a Vec<X, A>
where
A: Allocator,
F: FnMut(&U) -> V,
F: FnMut(&X) -> Y,
Vec<Y, A>: FromIterator<Y>,
{
type Cont<_T> = Vec<_T, A>;
type Elem = &'a U;
type Elem = &'a X;

fn apply(&self, f: F) -> Self::Cont<V> {
fn apply(&self, f: F) -> Self::Cont<Y> {
self.iter().map(f).collect()
}
}
Expand All @@ -132,6 +133,7 @@ mod impl_alloc {
impl<'a, U, V, F> MapTo<F, V> for &'a Vec<U>
where
F: FnMut(&U) -> V,
Vec<V>: FromIterator<V>,
{
type Cont<_T> = Vec<_T>;
type Elem = &'a U;
Expand Down
Loading