Skip to content

Commit

Permalink
Merge #282
Browse files Browse the repository at this point in the history
282: Remove prelude. r=therealprof a=Dirbaio

**DEPENDS on #280**

Following discussions in #280 #281, we might want to use the same method names for the `blocking` and `nb` (and in the future, `futures`) trait flavors.

In that case, importing the prelude guarantees naming conflicts, so it's better to remove it.

An alternative would be splitting the prelude in `blocking` and `nb`. However, users often use blocking trait A and nonblocking trait B at the same time, so they'd end up importing both preludes and having name conflicts anyway.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
  • Loading branch information
bors[bot] and Dirbaio committed Jun 29, 2021
2 parents 0ab50cd + b6419e3 commit facfe77
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 48 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Re-export `nb::{block!, Error, Result}` to avoid version mismatches. These should be used instead of
importing the `nb` crate directly in dependendent crates.
- `blocking::Serial`: renamed `bwrite_all` to `write`, `bflush` to `flush.
- Removed `prelude` to avoid method name conflicts between different flavors (blocking, nb) of the same trait. Traits must now be manually imported.

## [v1.0.0-alpha.4] - 2020-11-11

Expand Down
2 changes: 1 addition & 1 deletion src/blocking/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/// ```
/// extern crate embedded_hal as hal;
///
/// use hal::prelude::*;
/// use hal::blocking::pwm::Pwm;
///
/// fn main() {
/// let mut pwm: Pwm1 = {
Expand Down
3 changes: 2 additions & 1 deletion src/blocking/qei.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
/// #[macro_use(block)]
/// extern crate nb;
///
/// use hal::prelude::*;
/// use hal::blocking::qei::Qei;
/// use hal::nb::timer::CountDown;
///
/// fn main() {
/// let mut qei: Qei1 = {
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
//! ```
//! use embedded_hal as hal;
//! use nb::block;
//! use hal::prelude::*;
//! use hal::nb::serial::Write;
//!
//! fn write_all<S>(serial: &mut S, buffer: &[u8]) -> Result<(), S::Error>
//! where
Expand All @@ -266,7 +266,8 @@
//! use embedded_hal as hal;
//! use nb;
//!
//! use hal::prelude::*;
//! use hal::nb::serial::Write;
//! use hal::nb::timer::CountDown;
//!
//! enum Error<SE, TE> {
//! /// Serial interface error
Expand Down Expand Up @@ -320,7 +321,7 @@
//! use embedded_hal as hal;
//! use nb;
//!
//! use hal::prelude::*;
//! use hal::nb::serial::Write;
//! use ::core::convert::Infallible;
//!
//! fn flush<S>(serial: &mut S, cb: &mut CircularBuffer)
Expand Down Expand Up @@ -411,7 +412,6 @@
pub mod blocking;
pub mod fmt;
pub mod nb;
pub mod prelude;

mod private {
use crate::blocking::i2c::{SevenBitAddress, TenBitAddress};
Expand Down
2 changes: 1 addition & 1 deletion src/nb/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/// #[macro_use(block)]
/// extern crate nb;
///
/// use hal::prelude::*;
/// use hal::nb::capture::Capture;
///
/// fn main() {
/// let mut capture: Capture1 = {
Expand Down
2 changes: 1 addition & 1 deletion src/nb/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/// #[macro_use(block)]
/// extern crate nb;
///
/// use hal::prelude::*;
/// use hal::nb::timer::CountDown;
///
/// fn main() {
/// let mut led: Led = {
Expand Down
40 changes: 0 additions & 40 deletions src/prelude.rs

This file was deleted.

0 comments on commit facfe77

Please sign in to comment.