Skip to content

Commit

Permalink
Add optional defmt support.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Oct 30, 2024
1 parent 8a340f4 commit fbad743
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

include:
# Test MSRV
- rust: 1.59.0
- rust: 1.60.0
TARGET: x86_64-unknown-linux-gnu

# Test nightly but don't fail
Expand Down
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ documentation = "https://docs.rs/embedded-storage"
readme = "README.md"
keywords = ["storage"]
categories = ["embedded", "hardware-support", "no-std"]

[dependencies]
defmt = { version = "0.3.8", optional = true }

[features]
default = []
defmt = ["dep:defmt"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ These issues / PRs will be labeled as `proposal`s in the issue tracker.

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.59.0 and up. It _might_
This crate is guaranteed to compile on stable Rust 1.60.0 and up. It _might_
compile with older versions but that may change in any new patch release.

## License
Expand Down
2 changes: 2 additions & 0 deletions src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub trait BlockDevice<const BLOCK_SIZE: usize = 512> {

/// The linear numeric address of a block (or sector).
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct BlockIdx(pub u64);

impl BlockIdx {
Expand Down Expand Up @@ -80,6 +81,7 @@ impl SubAssign<BlockCount> for BlockIdx {
///
/// This may be added to a [`BlockIdx`] to get another `BlockIdx`.
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct BlockCount(pub u64);

impl Add<BlockCount> for BlockCount {
Expand Down

0 comments on commit fbad743

Please sign in to comment.