Skip to content

Commit 750f0be

Browse files
committed
Rename methods try_* for consistency
1 parent da83c02 commit 750f0be

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,17 @@
216216
//! };
217217
//!
218218
//! for byte in b"Hello, world!" {
219-
//! // NOTE `block!` blocks until `serial.write()` completes and returns
219+
//! // NOTE `block!` blocks until `serial.try_write()` completes and returns
220220
//! // `Result<(), Error>`
221-
//! block!(serial.write(*byte)).unwrap();
221+
//! block!(serial.try_write(*byte)).unwrap();
222222
//! }
223223
//! # }
224224
//!
225225
//! # mod stm32f30x_hal {
226226
//! # use std::convert::Infallible;
227227
//! # pub struct Serial1;
228228
//! # impl Serial1 {
229-
//! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Infallible> {
229+
//! # pub fn try_write(&mut self, _: u8) -> ::nb::Result<(), Infallible> {
230230
//! # Ok(())
231231
//! # }
232232
//! # }
@@ -419,7 +419,7 @@
419419
//! loop {
420420
//! // `await!` means "suspend / yield here" instead of "block until
421421
//! // completion"
422-
//! nb::r#await!(timer.wait()).unwrap(); // NOTE(unwrap) E = Infallible
422+
//! nb::r#await!(timer.try_wait()).unwrap(); // NOTE(unwrap) E = Infallible
423423
//!
424424
//! state = !state;
425425
//!
@@ -433,8 +433,8 @@
433433
//!
434434
//! let mut loopback = (move || {
435435
//! loop {
436-
//! let byte = nb::r#await!(serial.read()).unwrap();
437-
//! nb::r#await!(serial.write(byte)).unwrap();
436+
//! let byte = nb::r#await!(serial.try_read()).unwrap();
437+
//! nb::r#await!(serial.try_write(byte)).unwrap();
438438
//! }
439439
//! });
440440
//!
@@ -450,12 +450,12 @@
450450
//! # use std::convert::Infallible;
451451
//! # pub struct Serial1;
452452
//! # impl Serial1 {
453-
//! # pub fn read(&mut self) -> ::nb::Result<u8, Infallible> { Err(::nb::Error::WouldBlock) }
454-
//! # pub fn write(&mut self, _: u8) -> ::nb::Result<(), Infallible> { Err(::nb::Error::WouldBlock) }
453+
//! # pub fn try_read(&mut self) -> ::nb::Result<u8, Infallible> { Err(::nb::Error::WouldBlock) }
454+
//! # pub fn try_write(&mut self, _: u8) -> ::nb::Result<(), Infallible> { Err(::nb::Error::WouldBlock) }
455455
//! # }
456456
//! # pub struct Timer6;
457457
//! # impl Timer6 {
458-
//! # pub fn wait(&mut self) -> ::nb::Result<(), Infallible> { Err(::nb::Error::WouldBlock) }
458+
//! # pub fn try_wait(&mut self) -> ::nb::Result<(), Infallible> { Err(::nb::Error::WouldBlock) }
459459
//! # }
460460
//! # pub struct Led;
461461
//! # impl Led {

0 commit comments

Comments
 (0)