Skip to content

Commit

Permalink
Merge pull request #22 from contain-rs/new-features
Browse files Browse the repository at this point in the history
Add more features: allocator-api2, no_std and (de)serialization
  • Loading branch information
pczarn authored Dec 2, 2024
2 parents 5b69cc2 + 0844a8a commit 49f40d2
Show file tree
Hide file tree
Showing 9 changed files with 703 additions and 107 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Rust

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- run: cargo test --verbose
- run: cargo test --features serde --verbose
- run: cargo test --features miniserde --verbose
- run: cargo test --features nanoserde --verbose
- run: cargo test --features borsh --verbose
- run: cargo test --no-default-features --verbose
- run: cargo test --no-default-features --features serde_no_std --verbose

miri:
name: "Miri"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Miri
run: |
rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup
- name: Test with Miri
run: MIRIFLAGS=-Zmiri-strict-provenance cargo miri test

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- run: cargo fmt --all -- --check


clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- run: cargo clippy --workspace --tests --examples


docs:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: swatinem/rust-cache@v2
- run: cargo doc --workspace --no-deps

msrv:
name: Rust ${{matrix.rust}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [1.67.0, 1.68.0]
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
- run: cargo test --verbose
- run: cargo test --features serde --verbose
- run: cargo test --features miniserde --verbose
- run: cargo test --features nanoserde --verbose
- run: cargo test --features borsh --verbose
- run: cargo test --no-default-features --verbose
- run: cargo test --no-default-features --features serde_no_std --verbose
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
target
Cargo.lock
/target
/Cargo.lock
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rust-analyzer.cargo.features": ["serde", "miniserde", "nanoserde", "borsh"]
}
28 changes: 25 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,40 @@

name = "linked-list"
version = "0.0.3"
license = "MIT/Apache-2.0"
license = "MIT OR Apache-2.0"
description = "An alternative implementation of std::collections::LinkedList"

authors = [
"Alexis Beingessner <[email protected]>",
"Peter Blackson <[email protected]>",
]

edition = "2021"
rust-version = "1.67"

repository = "https://github.com/contain-rs/linked-list"
homepage = "https://github.com/contain-rs/linked-list"
documentation = "https://contain-rs.github.io/linked-list/linked_list"
documentation = "https://docs.rs/linked-list/latest/linked_list"
keywords = ["data-structures"]
readme = "README.md"

[dependencies]
allocator-api2 = "0.2.20"
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
borsh = { version = "1.5", default-features = false, features = ["derive", "std"], optional = true }
miniserde = { version = "0.1", optional = true }
nanoserde = { version = "0.1", optional = true }

[dev-dependencies]
serde_json = "1.0"

[features]
nightly = []
default = ["std"]
std = []

serde_std = ["std", "serde/std"]
serde_no_std = ["serde/alloc"]
borsh = ["dep:borsh", "std"]

[package.metadata.docs.rs]
features = ["serde", "miniserde", "nanoserde", "borsh"]
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015 The Rust Project Developers
Copyright (c) 2015-2024 The Rust Project Developers

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
67 changes: 65 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,66 @@
An alternative implementation of `std::collections::LinkedList` featuring a prototype Cursor.
<div align="center">
<h1>linked-list</h1>
<p>
<strong>A simple linked list.</strong>
</p>
<p>

Documentation is available at https://contain-rs.github.io/linked-list/linked_list.
[![crates.io][crates.io shield]][crates.io link]
[![Documentation][docs.rs badge]][docs.rs link]
![Rust CI][github ci badge]
![Minimum Supported Rustc Version][rustc 1.67+]
<br />
<br />
[![Dependency Status][deps.rs status]][deps.rs link]
[![Download Status][shields.io download count]][crates.io link]

</p>
</div>

[crates.io shield]: https://img.shields.io/crates/v/linked-list?label=latest
[crates.io link]: https://crates.io/crates/linked-list
[docs.rs badge]: https://docs.rs/linked-list/badge.svg?version=0.0.3
[docs.rs link]: https://docs.rs/linked-list/0.0.3/linked_list/
[github ci badge]: https://github.com/contain-rs/linked-list/workflows/Rust/badge.svg?branch=master
[rustc 1.67+]: https://img.shields.io/badge/rustc-1.67%2B-blue.svg
[deps.rs status]: https://deps.rs/crate/linked-list/0.0.3/status.svg
[deps.rs link]: https://deps.rs/crate/linked-list/0.0.3
[shields.io download count]: https://img.shields.io/crates/d/linked-list.svg

## Usage

Add this to your Cargo.toml:

```toml
[dependencies]
linked-list = "0.0.3"
```

Since Rust 2018, `extern crate` is no longer mandatory. If your edition is old (Rust 2015),
add this to your crate root:

```rust
extern crate linked_list;
```

If you want [serde](https://github.com/serde-rs/serde) support, include the feature like this:

```toml
[dependencies]
linked-list = { version = "0.0.3", features = ["serde"] }
```

<!-- cargo-rdme start -->

### Description

An alternative implementation of standard `LinkedList` featuring a prototype `Cursor`.

<!-- cargo-rdme end -->

## License

Dual-licensed for compatibility with the Rust project.

Licensed under the Apache License Version 2.0: http://www.apache.org/licenses/LICENSE-2.0,
or the MIT license: http://opensource.org/licenses/MIT, at your option.
20 changes: 0 additions & 20 deletions deploy-docs.sh

This file was deleted.

Loading

0 comments on commit 49f40d2

Please sign in to comment.