Skip to content

Commit dbecf9b

Browse files
bors[bot]eldruin
andauthored
Merge #34
34: Prepare v0.1.3 semver-trick release for nb 1.0 r=therealprof a=eldruin The changelog for 1.0 does not contain the entry for 0.1.3, though. I could add it before the release in #33 Co-authored-by: Diego Barrios Romero <[email protected]>
2 parents 67d7226 + 2536484 commit dbecf9b

13 files changed

+138
-159
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @rust-embedded/hal

.github/bors.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
block_labels = ["needs-decision"]
2+
delete_merged_branches = true
3+
required_approvals = 1
4+
status = [
5+
"ci-linux (stable, x86_64-unknown-linux-gnu)",
6+
"ci-linux (1.35.0, x86_64-unknown-linux-gnu)",
7+
]

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: Continuous integration
7+
8+
env:
9+
RUSTFLAGS: '-D warnings'
10+
11+
jobs:
12+
ci-linux:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
# All generated code should be running on stable now
17+
rust: [stable]
18+
19+
# The default target we're compiling on and for
20+
TARGET: [x86_64-unknown-linux-gnu]
21+
22+
include:
23+
# Test MSRV
24+
- rust: 1.35.0
25+
TARGET: x86_64-unknown-linux-gnu
26+
27+
# Test nightly but don't fail
28+
- rust: nightly
29+
experimental: true
30+
TARGET: x86_64-unknown-linux-gnu
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
- uses: actions-rs/toolchain@v1
35+
with:
36+
profile: minimal
37+
toolchain: ${{ matrix.rust }}
38+
target: ${{ matrix.TARGET }}
39+
override: true
40+
- uses: actions-rs/cargo@v1
41+
with:
42+
command: check
43+
args: --target=${{ matrix.TARGET }}
44+
- uses: actions-rs/cargo@v1
45+
with:
46+
command: test
47+
args: --target=${{ matrix.TARGET }}

.github/workflows/clippy.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: Clippy check
7+
8+
env:
9+
RUSTFLAGS: '-D warnings'
10+
11+
jobs:
12+
clippy_check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions-rs/toolchain@v1
17+
with:
18+
profile: minimal
19+
toolchain: stable
20+
override: true
21+
components: clippy
22+
- uses: actions-rs/clippy-check@v1
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/rustfmt.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: Code formatting check
7+
8+
jobs:
9+
fmt:
10+
name: Rustfmt
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions-rs/toolchain@v1
15+
with:
16+
profile: minimal
17+
toolchain: stable
18+
override: true
19+
components: rustfmt
20+
- uses: actions-rs/cargo@v1
21+
with:
22+
command: fmt
23+
args: --all -- --check

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## [v0.1.3] - 2020-07-07
11+
12+
This release of the 0.1 version exists for compatibility with 1.0.0.
13+
There are no functional changes compared to 0.1.2.
14+
1015
## [v0.1.2] - 2019-04-21
1116

1217
### Added
@@ -26,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2631

2732
Initial release
2833

29-
[Unreleased]: https://github.com/japaric/nb/compare/v0.1.2...HEAD
30-
[v0.1.2]: https://github.com/japaric/nb/compare/v0.1.1...v0.1.2
31-
[v0.1.1]: https://github.com/japaric/nb/compare/v0.1.0...v0.1.1
34+
[Unreleased]: https://github.com/rust-embedded/nb/compare/v0.1.3...HEAD
35+
[v0.1.3]: https://github.com/rust-embedded/nb/compare/v0.1.2...v0.1.3
36+
[v0.1.2]: https://github.com/rust-embedded/nb/compare/v0.1.1...v0.1.2
37+
[v0.1.1]: https://github.com/rust-embedded/nb/compare/v0.1.0...v0.1.1

Cargo.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@ description = "Minimal non-blocking I/O layer"
55
keywords = ["await", "futures", "IO"]
66
license = "MIT OR Apache-2.0"
77
name = "nb"
8-
repository = "https://github.com/japaric/nb"
9-
version = "0.1.2"
8+
repository = "https://github.com/rust-embedded/nb"
9+
homepage = "https://github.com/rust-embedded/nb"
10+
documentation = "https://docs.rs/nb"
11+
readme = "README.md"
12+
version = "0.1.3" # remember to update html_root_url
1013

1114
[features]
1215
unstable = []
1316

17+
[dependencies]
18+
nb = "1"
19+
1420
[dev-dependencies]
1521
futures = "0.1.17"
22+
23+
[lib]
24+
# Due to the semver-trick, doctests do not compile:
25+
# error[E0465]: multiple rlib candidates for `nb` found
26+
doctest = false

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
> Minimal and reusable non-blocking I/O layer
44
5+
This project is developed and maintained by the [HAL team][team].
6+
57
## [Documentation](https://docs.rs/nb)
68

79
## License
@@ -19,3 +21,5 @@ at your option.
1921
Unless you explicitly state otherwise, any contribution intentionally submitted
2022
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
2123
dual licensed as above, without any additional terms or conditions.
24+
25+
[team]: https://github.com/rust-embedded/wg#the-hal-team

ci/after_success.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

ci/install.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

ci/script.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/lib.rs

Lines changed: 10 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -355,53 +355,10 @@
355355
//! ```
356356
357357
#![no_std]
358-
#![deny(warnings)]
358+
#![doc(html_root_url = "https://docs.rs/nb/0.1.3")]
359359

360-
use core::fmt;
361-
362-
/// A non-blocking result
363-
pub type Result<T, E> = ::core::result::Result<T, Error<E>>;
364-
365-
/// A non-blocking error
366-
///
367-
/// The main use of this enum is to add a `WouldBlock` variant to an existing
368-
/// error enum.
369-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
370-
pub enum Error<E> {
371-
/// A different kind of error
372-
Other(E),
373-
/// This operation requires blocking behavior to complete
374-
WouldBlock,
375-
}
376-
377-
impl<E> fmt::Debug for Error<E>
378-
where
379-
E: fmt::Debug,
380-
{
381-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
382-
match *self {
383-
Error::Other(ref e) => fmt::Debug::fmt(e, f),
384-
Error::WouldBlock => f.write_str("WouldBlock"),
385-
}
386-
}
387-
}
388-
389-
impl<E> Error<E> {
390-
/// Maps an `Error<E>` to `Error<T>` by applying a function to a contained
391-
/// `Error::Other` value, leaving an `Error::WouldBlock` value untouched.
392-
pub fn map<T, F>(self, op: F) -> Error<T> where F: FnOnce(E) -> T {
393-
match self {
394-
Error::Other(e) => Error::Other(op(e)),
395-
Error::WouldBlock => Error::WouldBlock,
396-
}
397-
}
398-
}
399-
400-
impl<E> From<E> for Error<E> {
401-
fn from(error: E) -> Error<E> {
402-
Error::Other(error)
403-
}
404-
}
360+
extern crate nb;
361+
pub use nb::{block, Error, Result};
405362

406363
/// Await operation (*won't work until the language gains support for
407364
/// generators*)
@@ -429,47 +386,18 @@ macro_rules! await {
429386
loop {
430387
#[allow(unreachable_patterns)]
431388
match $e {
432-
Err($crate::Error::Other(e)) => {
389+
Err($crate::Error::Other(e)) =>
390+
{
433391
#[allow(unreachable_code)]
434392
break Err(e)
435-
},
436-
Err($crate::Error::WouldBlock) => {}, // yield (see below)
393+
}
394+
Err($crate::Error::WouldBlock) => {} // yield (see below)
437395
Ok(x) => break Ok(x),
438396
}
439397

440398
yield
441399
}
442-
}
443-
}
444-
445-
/// Turns the non-blocking expression `$e` into a blocking operation.
446-
///
447-
/// This is accomplished by continuously calling the expression `$e` until it no
448-
/// longer returns `Error::WouldBlock`
449-
///
450-
/// # Input
451-
///
452-
/// An expression `$e` that evaluates to `nb::Result<T, E>`
453-
///
454-
/// # Output
455-
///
456-
/// - `Ok(t)` if `$e` evaluates to `Ok(t)`
457-
/// - `Err(e)` if `$e` evaluates to `Err(nb::Error::Other(e))`
458-
#[macro_export]
459-
macro_rules! block {
460-
($e:expr) => {
461-
loop {
462-
#[allow(unreachable_patterns)]
463-
match $e {
464-
Err($crate::Error::Other(e)) => {
465-
#[allow(unreachable_code)]
466-
break Err(e)
467-
},
468-
Err($crate::Error::WouldBlock) => {},
469-
Ok(x) => break Ok(x),
470-
}
471-
}
472-
}
400+
};
473401
}
474402

475403
/// Future adapter
@@ -503,10 +431,8 @@ macro_rules! try_nb {
503431
($e:expr) => {
504432
match $e {
505433
Err($crate::Error::Other(e)) => return Err(e),
506-
Err($crate::Error::WouldBlock) => {
507-
return Ok(::futures::Async::NotReady)
508-
},
434+
Err($crate::Error::WouldBlock) => return Ok(::futures::Async::NotReady),
509435
Ok(x) => x,
510436
}
511-
}
437+
};
512438
}

0 commit comments

Comments
 (0)