9090//! [`WouldBlock`]: https://docs.rs/nb/0.1.0/nb/enum.Error.html
9191//!
9292//! Some traits, like the one shown below, may expose possibly blocking APIs that can't fail. In
93- //! those cases `nb::Result<_, Void >` is used.
93+ //! those cases `nb::Result<_, Infallible >` is used.
9494//!
9595//! ```
9696//! extern crate nb;
97- //! extern crate void;
9897//!
99- //! use void::Void;
98+ //! # use std as core;
99+ //! use core::convert::Infallible;
100100//!
101101//! /// A count down timer
102102//! pub trait CountDown {
103103//! // ..
104104//!
105105//! /// "waits" until the count down is over
106- //! fn wait(&mut self) -> nb::Result<(), Void >;
106+ //! fn wait(&mut self) -> nb::Result<(), Infallible >;
107107//! }
108108//!
109109//! # fn main() {}
223223//! # }
224224//!
225225//! # mod stm32f30x_hal {
226- //! # extern crate void;
227- //! # use self::void::Void;
226+ //! # use std::convert::Infallible;
228227//! # pub struct Serial1;
229228//! # impl Serial1 {
230- //! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Void > {
229+ //! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Infallible > {
231230//! # Ok(())
232231//! # }
233232//! # }
242241//! ```
243242//! extern crate embedded_hal as hal;
244243//! extern crate futures;
245- //! extern crate void;
246244//!
247245//! #[macro_use(try_nb)]
248246//! extern crate nb;
255253//! };
256254//! use futures::future::Loop;
257255//! use stm32f30x_hal::{Led, Serial1, Timer6};
258- //! use void::Void ;
256+ //! use std::convert::Infallible ;
259257//!
260258//! /// `futures` version of `CountDown.wait`
261259//! ///
262260//! /// This returns a future that must be polled to completion
263- //! fn wait<T>(mut timer: T) -> impl Future<Item = T, Error = Void >
261+ //! fn wait<T>(mut timer: T) -> impl Future<Item = T, Error = Infallible >
264262//! where
265263//! T: hal::timer::CountDown,
266264//! {
342340//!
343341//! // Event loop
344342//! loop {
345- //! blinky.poll().unwrap(); // NOTE(unwrap) E = Void
343+ //! blinky.poll().unwrap(); // NOTE(unwrap) E = Infallible
346344//! loopback.poll().unwrap();
347345//! # break;
348346//! }
349347//! }
350348//!
351349//! # mod stm32f30x_hal {
352- //! # extern crate void;
353- //! # use self::void::Void;
350+ //! # use std::convert::Infallible;
354351//! # pub struct Timer6;
355352//! # impl ::hal::timer::CountDown for Timer6 {
356353//! # type Time = ();
357354//! #
358355//! # fn start<T>(&mut self, _: T) where T: Into<()> {}
359- //! # fn wait(&mut self) -> ::nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
356+ //! # fn wait(&mut self) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
360357//! # }
361358//! #
362359//! # pub struct Serial1;
363360//! # impl ::hal::serial::Read<u8> for Serial1 {
364- //! # type Error = Void ;
365- //! # fn read(&mut self) -> ::nb::Result<u8, Void > { Err(::nb::Error::WouldBlock) }
361+ //! # type Error = Infallible ;
362+ //! # fn read(&mut self) -> ::nb::Result<u8, Infallible > { Err(::nb::Error::WouldBlock) }
366363//! # }
367364//! # impl ::hal::serial::Write<u8> for Serial1 {
368- //! # type Error = Void ;
369- //! # fn flush(&mut self) -> ::nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
370- //! # fn write(&mut self, _: u8) -> ::nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
365+ //! # type Error = Infallible ;
366+ //! # fn flush(&mut self) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
367+ //! # fn write(&mut self, _: u8) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
371368//! # }
372369//! #
373370//! # pub struct Led;
418415//! loop {
419416//! // `await!` means "suspend / yield here" instead of "block until
420417//! // completion"
421- //! await!(timer.wait()).unwrap(); // NOTE(unwrap) E = Void
418+ //! await!(timer.wait()).unwrap(); // NOTE(unwrap) E = Infallible
422419//!
423420//! state = !state;
424421//!
446443//! }
447444//!
448445//! # mod stm32f30x_hal {
449- //! # extern crate void;
450- //! # use self::void::Void;
446+ //! # use std::convert::Infallible;
451447//! # pub struct Serial1;
452448//! # impl Serial1 {
453- //! # pub fn read(&mut self) -> ::nb::Result<u8, Void > { Err(::nb::Error::WouldBlock) }
454- //! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
449+ //! # pub fn read(&mut self) -> ::nb::Result<u8, Infallible > { Err(::nb::Error::WouldBlock) }
450+ //! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
455451//! # }
456452//! # pub struct Timer6;
457453//! # impl Timer6 {
458- //! # pub fn wait(&mut self) -> ::nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
454+ //! # pub fn wait(&mut self) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
459455//! # }
460456//! # pub struct Led;
461457//! # impl Led {
594590//! - Buffered serial interface with periodic flushing in interrupt handler
595591//!
596592//! ```
593+ //! # use std as core;
597594//! extern crate embedded_hal as hal;
598595//! extern crate nb;
599- //! extern crate void;
600596//!
601597//! use hal::prelude::*;
602- //! use void::Void ;
598+ //! use core::convert::Infallible ;
603599//!
604600//! fn flush<S>(serial: &mut S, cb: &mut CircularBuffer)
605601//! where
606- //! S: hal::serial::Write<u8, Error = Void >,
602+ //! S: hal::serial::Write<u8, Error = Infallible >,
607603//! {
608604//! loop {
609605//! if let Some(byte) = cb.peek() {
668664//! # }
669665//! # struct Serial1;
670666//! # impl ::hal::serial::Write<u8> for Serial1 {
671- //! # type Error = Void ;
672- //! # fn write(&mut self, _: u8) -> nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
673- //! # fn flush(&mut self) -> nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
667+ //! # type Error = Infallible ;
668+ //! # fn write(&mut self, _: u8) -> nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
669+ //! # fn flush(&mut self) -> nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
674670//! # }
675671//! # struct CircularBuffer;
676672//! # impl CircularBuffer {
687683
688684#[ macro_use]
689685extern crate nb;
690- extern crate void;
691686
692687pub mod adc;
693688pub mod blocking;
@@ -731,8 +726,7 @@ pub mod watchdog;
731726/// println!("Period: {} ms", period);
732727/// }
733728///
734- /// # extern crate void;
735- /// # use void::Void;
729+ /// # use std::convert::Infallible;
736730/// # struct MilliSeconds(u32);
737731/// # trait U32Ext { fn ms(self) -> MilliSeconds; }
738732/// # impl U32Ext for u32 { fn ms(self) -> MilliSeconds { MilliSeconds(self) } }
@@ -741,9 +735,9 @@ pub mod watchdog;
741735/// # impl hal::Capture for Capture1 {
742736/// # type Capture = u16;
743737/// # type Channel = Channel;
744- /// # type Error = Void ;
738+ /// # type Error = Infallible ;
745739/// # type Time = MilliSeconds;
746- /// # fn capture(&mut self, _: Channel) -> ::nb::Result<u16, Void > { Ok(0) }
740+ /// # fn capture(&mut self, _: Channel) -> ::nb::Result<u16, Infallible > { Ok(0) }
747741/// # fn disable(&mut self, _: Channel) { unimplemented!() }
748742/// # fn enable(&mut self, _: Channel) { unimplemented!() }
749743/// # fn get_resolution(&self) -> MilliSeconds { unimplemented!() }
@@ -948,8 +942,7 @@ pub trait PwmPin {
948942/// println!("Speed: {} pulses per second", speed);
949943/// }
950944///
951- /// # extern crate void;
952- /// # use void::Void;
945+ /// # use std::convert::Infallible;
953946/// # struct Seconds(u32);
954947/// # trait U32Ext { fn s(self) -> Seconds; }
955948/// # impl U32Ext for u32 { fn s(self) -> Seconds { Seconds(self) } }
@@ -963,7 +956,7 @@ pub trait PwmPin {
963956/// # impl hal::timer::CountDown for Timer6 {
964957/// # type Time = Seconds;
965958/// # fn start<T>(&mut self, _: T) where T: Into<Seconds> {}
966- /// # fn wait(&mut self) -> ::nb::Result<(), Void > { Ok(()) }
959+ /// # fn wait(&mut self) -> ::nb::Result<(), Infallible > { Ok(()) }
967960/// # }
968961/// ```
969962#[ cfg( feature = "unproven" ) ]
0 commit comments