Skip to content

Remove try_ prefix #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

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

## [0.1.0] - 2021-05-18

Initial release to crates.io.

[Unreleased]: https://github.com/rust-embedded-community/embedded-storage/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/rust-embedded-community/embedded-storage/releases/tag/v0.1.0
[unreleased]: https://github.com/rust-embedded-community/embedded-storage/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/rust-embedded-community/embedded-storage/releases/tag/v0.1.0
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub trait ReadStorage {
///
/// This should throw an error in case `bytes.len()` will be larger than
/// `self.capacity() - offset`.
fn try_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>;
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>;

/// The capacity of the storage peripheral in bytes.
fn capacity(&self) -> usize;
Expand All @@ -43,5 +43,5 @@ pub trait Storage: ReadStorage {
/// **NOTE:**
/// This function will automatically erase any pages necessary to write the given data,
/// and might as such do RMW operations at an undesirable performance impact.
fn try_write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>;
fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>;
}
6 changes: 3 additions & 3 deletions src/nor_flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub trait ReadNorFlash {
///
/// This should throw an error in case `bytes.len()` will be larger than
/// the peripheral end address.
fn try_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>;
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>;

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

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

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