Skip to content

Commit

Permalink
Derive common traits for public types
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed Feb 7, 2025
1 parent 69121a8 commit 8fa63ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

- Relax lifetime constraint on `I2CTransfer::transfer` `msgs` reference
- Relax lifetime constraint on `I2CTransfer::transfer` `msgs` reference.
- Derived common traits for public types.

## [v0.6.1] - 2024-05-09

Expand Down
2 changes: 2 additions & 0 deletions src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ use std::path::Path;
pub use core::I2CMessage;

/// Concrete linux I2C device
#[derive(Debug)]
pub struct LinuxI2CDevice {
devfile: File,
slave_address: u16,
pec: bool,
}

/// Linux I2C bus
#[derive(Debug)]
pub struct LinuxI2CBus {
devfile: File,
}
Expand Down
3 changes: 2 additions & 1 deletion src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::io;
pub type I2CResult<T> = io::Result<T>;

/// Mock I2C device register map
#[derive(Debug, Clone, Copy)]
pub struct I2CRegisterMap {
registers: [u8; 0xFF],
offset: usize,
Expand Down Expand Up @@ -67,7 +68,7 @@ impl I2CRegisterMap {
}

/// Mock I2C device exposing a register map
#[derive(Default)]
#[derive(Default, Debug, Clone, Copy)]
pub struct MockI2CDevice {
/// I2C register map
pub regmap: I2CRegisterMap,
Expand Down

0 comments on commit 8fa63ac

Please sign in to comment.