Skip to content

Commit b25cd4a

Browse files
committed
Prepare 0.1.3 release
1 parent c7d733e commit b25cd4a

File tree

4 files changed

+25
-79
lines changed

4 files changed

+25
-79
lines changed

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-03
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: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ 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"

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

src/lib.rs

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

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

405363
/// Await operation (*won't work until the language gains support for
406364
/// generators*)
@@ -441,35 +399,7 @@ macro_rules! await {
441399
}
442400
}
443401

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

474404
/// Future adapter
475405
///

0 commit comments

Comments
 (0)