Skip to content

Commit a1b9805

Browse files
Dirbaioeldruin
andauthored
Remove try_ prefix (#17)
* Remove try_ prefix * Add changelog. * Undo caseness change Co-authored-by: Diego Barrios Romero <[email protected]>
1 parent abcbd3d commit a1b9805

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## Unreleased
99

10-
* None
10+
- Removed `try_` prefix from all trait methods.
1111

1212
## [0.1.0] - 2021-05-18
1313

1414
Initial release to crates.io.
1515

1616
[Unreleased]: https://github.com/rust-embedded-community/embedded-storage/compare/v0.1.0...HEAD
17-
[0.1.0]: https://github.com/rust-embedded-community/embedded-storage/releases/tag/v0.1.0
17+
[0.1.0]: https://github.com/rust-embedded-community/embedded-storage/releases/tag/v0.1.0

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub trait ReadStorage {
2929
///
3030
/// This should throw an error in case `bytes.len()` will be larger than
3131
/// `self.capacity() - offset`.
32-
fn try_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>;
32+
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>;
3333

3434
/// The capacity of the storage peripheral in bytes.
3535
fn capacity(&self) -> usize;
@@ -43,5 +43,5 @@ pub trait Storage: ReadStorage {
4343
/// **NOTE:**
4444
/// This function will automatically erase any pages necessary to write the given data,
4545
/// and might as such do RMW operations at an undesirable performance impact.
46-
fn try_write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>;
46+
fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>;
4747
}

src/nor_flash.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub trait ReadNorFlash {
1111
///
1212
/// This should throw an error in case `bytes.len()` will be larger than
1313
/// the peripheral end address.
14-
fn try_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>;
14+
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>;
1515

1616
/// The capacity of the peripheral in bytes.
1717
fn capacity(&self) -> usize;
@@ -32,13 +32,13 @@ pub trait NorFlash: ReadNorFlash {
3232
/// erase resolution
3333
/// If power is lost during erase, contents of the page are undefined.
3434
/// `from` and `to` must both be multiples of `ERASE_SIZE` and `from` <= `to`.
35-
fn try_erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error>;
35+
fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error>;
3636

3737
/// If power is lost during write, the contents of the written words are undefined,
3838
/// but the rest of the page is guaranteed to be unchanged.
3939
/// It is not allowed to write to the same word twice.
4040
/// `offset` and `bytes.len()` must both be multiples of `WRITE_SIZE`.
41-
fn try_write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>;
41+
fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>;
4242
}
4343

4444
/// Marker trait for NorFlash relaxing the restrictions on `write`.

0 commit comments

Comments
 (0)