90
90
//! [`WouldBlock`]: https://docs.rs/nb/0.1.0/nb/enum.Error.html
91
91
//!
92
92
//! 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.
94
94
//!
95
95
//! ```
96
96
//! extern crate nb;
97
- //! extern crate void;
98
97
//!
99
- //! use void::Void ;
98
+ //! use core::convert::Infallible ;
100
99
//!
101
100
//! /// A count down timer
102
101
//! pub trait CountDown {
103
102
//! // ..
104
103
//!
105
104
//! /// "waits" until the count down is over
106
- //! fn wait(&mut self) -> nb::Result<(), Void >;
105
+ //! fn wait(&mut self) -> nb::Result<(), Infallible >;
107
106
//! }
108
107
//!
109
108
//! # fn main() {}
223
222
//! # }
224
223
//!
225
224
//! # mod stm32f30x_hal {
226
- //! # extern crate void;
227
- //! # use self::void::Void;
225
+ //! # use core::convert::Infallible;
228
226
//! # pub struct Serial1;
229
227
//! # impl Serial1 {
230
- //! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Void > {
228
+ //! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Infallible > {
231
229
//! # Ok(())
232
230
//! # }
233
231
//! # }
242
240
//! ```
243
241
//! extern crate embedded_hal as hal;
244
242
//! extern crate futures;
245
- //! extern crate void;
246
243
//!
247
244
//! #[macro_use(try_nb)]
248
245
//! extern crate nb;
255
252
//! };
256
253
//! use futures::future::Loop;
257
254
//! use stm32f30x_hal::{Led, Serial1, Timer6};
258
- //! use void::Void ;
255
+ //! use core::convert::Infallible ;
259
256
//!
260
257
//! /// `futures` version of `CountDown.wait`
261
258
//! ///
262
259
//! /// This returns a future that must be polled to completion
263
- //! fn wait<T>(mut timer: T) -> impl Future<Item = T, Error = Void >
260
+ //! fn wait<T>(mut timer: T) -> impl Future<Item = T, Error = Infallible >
264
261
//! where
265
262
//! T: hal::timer::CountDown,
266
263
//! {
342
339
//!
343
340
//! // Event loop
344
341
//! loop {
345
- //! blinky.poll().unwrap(); // NOTE(unwrap) E = Void
342
+ //! blinky.poll().unwrap(); // NOTE(unwrap) E = Infallible
346
343
//! loopback.poll().unwrap();
347
344
//! # break;
348
345
//! }
349
346
//! }
350
347
//!
351
348
//! # mod stm32f30x_hal {
352
- //! # extern crate void;
353
- //! # use self::void::Void;
349
+ //! # use core::convert::Infallible;
354
350
//! # pub struct Timer6;
355
351
//! # impl ::hal::timer::CountDown for Timer6 {
356
352
//! # type Time = ();
357
353
//! #
358
354
//! # fn start<T>(&mut self, _: T) where T: Into<()> {}
359
- //! # fn wait(&mut self) -> ::nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
355
+ //! # fn wait(&mut self) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
360
356
//! # }
361
357
//! #
362
358
//! # pub struct Serial1;
363
359
//! # impl ::hal::serial::Read<u8> for Serial1 {
364
- //! # type Error = Void ;
365
- //! # fn read(&mut self) -> ::nb::Result<u8, Void > { Err(::nb::Error::WouldBlock) }
360
+ //! # type Error = Infallible ;
361
+ //! # fn read(&mut self) -> ::nb::Result<u8, Infallible > { Err(::nb::Error::WouldBlock) }
366
362
//! # }
367
363
//! # 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) }
364
+ //! # type Error = Infallible ;
365
+ //! # fn flush(&mut self) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
366
+ //! # fn write(&mut self, _: u8) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
371
367
//! # }
372
368
//! #
373
369
//! # pub struct Led;
418
414
//! loop {
419
415
//! // `await!` means "suspend / yield here" instead of "block until
420
416
//! // completion"
421
- //! await!(timer.wait()).unwrap(); // NOTE(unwrap) E = Void
417
+ //! await!(timer.wait()).unwrap(); // NOTE(unwrap) E = Infallible
422
418
//!
423
419
//! state = !state;
424
420
//!
446
442
//! }
447
443
//!
448
444
//! # mod stm32f30x_hal {
449
- //! # extern crate void;
450
- //! # use self::void::Void;
445
+ //! # use core::convert::Infallible;
451
446
//! # pub struct Serial1;
452
447
//! # 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) }
448
+ //! # pub fn read(&mut self) -> ::nb::Result<u8, Infallible > { Err(::nb::Error::WouldBlock) }
449
+ //! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
455
450
//! # }
456
451
//! # pub struct Timer6;
457
452
//! # impl Timer6 {
458
- //! # pub fn wait(&mut self) -> ::nb::Result<(), Void > { Err(::nb::Error::WouldBlock) }
453
+ //! # pub fn wait(&mut self) -> ::nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
459
454
//! # }
460
455
//! # pub struct Led;
461
456
//! # impl Led {
596
591
//! ```
597
592
//! extern crate embedded_hal as hal;
598
593
//! extern crate nb;
599
- //! extern crate void;
600
594
//!
601
595
//! use hal::prelude::*;
602
- //! use void::Void ;
596
+ //! use core::convert::Infallible ;
603
597
//!
604
598
//! fn flush<S>(serial: &mut S, cb: &mut CircularBuffer)
605
599
//! where
606
- //! S: hal::serial::Write<u8, Error = Void >,
600
+ //! S: hal::serial::Write<u8, Error = Infallible >,
607
601
//! {
608
602
//! loop {
609
603
//! if let Some(byte) = cb.peek() {
668
662
//! # }
669
663
//! # struct Serial1;
670
664
//! # 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) }
665
+ //! # type Error = Infallible ;
666
+ //! # fn write(&mut self, _: u8) -> nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
667
+ //! # fn flush(&mut self) -> nb::Result<(), Infallible > { Err(::nb::Error::WouldBlock) }
674
668
//! # }
675
669
//! # struct CircularBuffer;
676
670
//! # impl CircularBuffer {
687
681
688
682
#[ macro_use]
689
683
extern crate nb;
690
- extern crate void;
691
684
692
685
pub mod adc;
693
686
pub mod blocking;
@@ -731,8 +724,7 @@ pub mod watchdog;
731
724
/// println!("Period: {} ms", period);
732
725
/// }
733
726
///
734
- /// # extern crate void;
735
- /// # use void::Void;
727
+ /// # use core::convert::Infallible;
736
728
/// # struct MilliSeconds(u32);
737
729
/// # trait U32Ext { fn ms(self) -> MilliSeconds; }
738
730
/// # impl U32Ext for u32 { fn ms(self) -> MilliSeconds { MilliSeconds(self) } }
@@ -741,9 +733,9 @@ pub mod watchdog;
741
733
/// # impl hal::Capture for Capture1 {
742
734
/// # type Capture = u16;
743
735
/// # type Channel = Channel;
744
- /// # type Error = Void ;
736
+ /// # type Error = Infallible ;
745
737
/// # type Time = MilliSeconds;
746
- /// # fn capture(&mut self, _: Channel) -> ::nb::Result<u16, Void > { Ok(0) }
738
+ /// # fn capture(&mut self, _: Channel) -> ::nb::Result<u16, Infallible > { Ok(0) }
747
739
/// # fn disable(&mut self, _: Channel) { unimplemented!() }
748
740
/// # fn enable(&mut self, _: Channel) { unimplemented!() }
749
741
/// # fn get_resolution(&self) -> MilliSeconds { unimplemented!() }
@@ -948,8 +940,7 @@ pub trait PwmPin {
948
940
/// println!("Speed: {} pulses per second", speed);
949
941
/// }
950
942
///
951
- /// # extern crate void;
952
- /// # use void::Void;
943
+ /// # use core::convert::Infallible;
953
944
/// # struct Seconds(u32);
954
945
/// # trait U32Ext { fn s(self) -> Seconds; }
955
946
/// # impl U32Ext for u32 { fn s(self) -> Seconds { Seconds(self) } }
@@ -963,7 +954,7 @@ pub trait PwmPin {
963
954
/// # impl hal::timer::CountDown for Timer6 {
964
955
/// # type Time = Seconds;
965
956
/// # fn start<T>(&mut self, _: T) where T: Into<Seconds> {}
966
- /// # fn wait(&mut self) -> ::nb::Result<(), Void > { Ok(()) }
957
+ /// # fn wait(&mut self) -> ::nb::Result<(), Infallible > { Ok(()) }
967
958
/// # }
968
959
/// ```
969
960
#[ cfg( feature = "unproven" ) ]
0 commit comments