Skip to content

Commit

Permalink
Merge pull request #42 from eldruin/updates
Browse files Browse the repository at this point in the history
Update CI + GHMQ + Improve readme
  • Loading branch information
Dirbaio authored Jul 20, 2023
2 parents 5274a5d + 2756227 commit 62c17d3
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 85 deletions.
7 changes: 0 additions & 7 deletions .github/bors.toml

This file was deleted.

49 changes: 24 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
on:
push:
branches: [ staging, trying, master ]
pull_request:
push: # Run CI for all branches except GitHub merge queue tmp branches
branches-ignore:
- "gh-readonly-queue/**"
pull_request: # Run CI for PRs on any branch
merge_group: # Run CI for the GitHub merge queue

name: Continuous integration

env:
RUSTFLAGS: '-D warnings'
RUSTFLAGS: '--deny warnings'

jobs:
ci-linux:
runs-on: ubuntu-latest
strategy:
matrix:
# All generated code should be running on stable now
rust: [stable]
rust:
- stable
- 1.62.0 # MSRV

# The default target we're compiling on and for
TARGET: [x86_64-unknown-linux-gnu]
features:
- ''
- 'defmt-0-3'

include:
# Test MSRV
- rust: 1.60.0
TARGET: x86_64-unknown-linux-gnu
target:
- x86_64-unknown-linux-gnu
- thumbv6m-none-eabi

include:
# Test nightly but don't fail
- rust: nightly
target: x86_64-unknown-linux-gnu
features: ''
experimental: true
TARGET: x86_64-unknown-linux-gnu

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.TARGET }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --target=${{ matrix.TARGET }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --target=${{ matrix.TARGET }}
target: ${{ matrix.target }}

- run: cargo check --target=${{ matrix.target }} --features=${{ matrix.features }}
- run: cargo test --target=${{ matrix.target }} --features=${{ matrix.features }}
if: contains(matrix.target, 'linux')
18 changes: 8 additions & 10 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
on:
push:
branches: [ staging, trying, master ]
pull_request:
push: # Run CI for all branches except GitHub merge queue tmp branches
branches-ignore:
- "gh-readonly-queue/**"
pull_request: # Run CI for PRs on any branch
merge_group: # Run CI for the GitHub merge queue

name: Clippy check

Expand All @@ -13,12 +15,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true
toolchain: 1.71.0
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- run: cargo clippy --all-targets --all-features
19 changes: 8 additions & 11 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
on:
push:
branches: [ staging, trying, master ]
pull_request:
push: # Run CI for all branches except GitHub merge queue tmp branches
branches-ignore:
- "gh-readonly-queue/**"
pull_request: # Run CI for PRs on any branch
merge_group: # Run CI for the GitHub merge queue

name: Code formatting check

Expand All @@ -11,13 +13,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true
toolchain: 1.71.0
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- run: cargo fmt --all -- --check
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed
- Raised MSRV to 1.62.0

## [v1.1.0] - 2023-03-07

### Added
Expand Down
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[![crates.io](https://img.shields.io/crates/d/nb.svg)](https://crates.io/crates/nb)
[![crates.io](https://img.shields.io/crates/v/nb.svg)](https://crates.io/crates/nb)
[![Documentation](https://docs.rs/nb/badge.svg)](https://docs.rs/nb)
![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.62+-blue.svg)

# `nb`

> Minimal and reusable non-blocking I/O layer
Expand All @@ -6,18 +11,47 @@ This project is developed and maintained by the [HAL team][team].

## [Documentation](https://docs.rs/nb)

The ultimate goal of this crate is *code reuse*. With this crate you can
write *core* I/O APIs that can then be adapted to operate in either blocking
or non-blocking manner. Furthermore those APIs are not tied to a particular
asynchronous model and can be adapted to work with the `futures` model or
with the `async` / `await` model.

### Core idea

The [`WouldBlock`](enum.Error.html) error variant signals that the operation
can't be completed *right now* and would need to block to complete.
[`WouldBlock`](enum.Error.html) is a special error in the sense that's not
*fatal*; the operation can still be completed by retrying again later.

[`nb::Result`](type.Result.html) is based on the API of
[`std::io::Result`](https://doc.rust-lang.org/std/io/type.Result.html),
which has a `WouldBlock` variant in its
[`ErrorKind`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html).

We can map [`WouldBlock`](enum.Error.html) to different blocking and
non-blocking models:

- In blocking mode: [`WouldBlock`](enum.Error.html) means try again right
now (i.e. busy wait)
- In `futures` mode: [`WouldBlock`](enum.Error.html) means
[`Async::NotReady`](https://docs.rs/futures)
- In `await` mode: [`WouldBlock`](enum.Error.html) means `yield`
(suspend the generator)


## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.35 and up. It *might*
This crate is guaranteed to compile on stable Rust 1.62 and up. It *might*
compile with older versions but that may change in any new patch release.

## License

Licensed under either of

- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
<http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)

at your option.

Expand Down
30 changes: 1 addition & 29 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
//! Minimal and reusable non-blocking I/O layer
//!
//! The ultimate goal of this crate is *code reuse*. With this crate you can
//! write *core* I/O APIs that can then be adapted to operate in either blocking
//! or non-blocking manner. Furthermore those APIs are not tied to a particular
//! asynchronous model and can be adapted to work with the `futures` model or
//! with the `async` / `await` model.
//!
//! # Core idea
//!
//! The [`WouldBlock`](enum.Error.html) error variant signals that the operation
//! can't be completed *right now* and would need to block to complete.
//! [`WouldBlock`](enum.Error.html) is a special error in the sense that's not
//! *fatal*; the operation can still be completed by retrying again later.
//!
//! [`nb::Result`](type.Result.html) is based on the API of
//! [`std::io::Result`](https://doc.rust-lang.org/std/io/type.Result.html),
//! which has a `WouldBlock` variant in its
//! [`ErrorKind`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html).
//!
//! We can map [`WouldBlock`](enum.Error.html) to different blocking and
//! non-blocking models:
//!
//! - In blocking mode: [`WouldBlock`](enum.Error.html) means try again right
//! now (i.e. busy wait)
//! - In `futures` mode: [`WouldBlock`](enum.Error.html) means
//! [`Async::NotReady`](https://docs.rs/futures)
//! - In `await` mode: [`WouldBlock`](enum.Error.html) means `yield`
//! (suspend the generator)
#![doc = include_str!("../README.md")]
//!
//! # How to use this crate
//!
Expand Down

0 comments on commit 62c17d3

Please sign in to comment.