Skip to content

Commit

Permalink
refactor(Fraction): Re-export Fraction type in duration and `rate…
Browse files Browse the repository at this point in the history
…` modules
  • Loading branch information
PTaylor-us committed Aug 7, 2020
1 parent 4f40b81 commit 174610e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [Unreleased]

### Changed

- Re-export `Fraction` type in the `duration` and `rate` module
- Allows for a single import (eg `use duration::*`) to support `Generic` usage which uses `Fraction`

[unreleased]: https://github.com/FluenTech/embedded-time/compare/v0.9.0...HEAD

## [0.9.0] - 2020-08-05
Expand Down
10 changes: 5 additions & 5 deletions src/duration.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Duration types/units
pub use crate::fraction::Fraction;
use crate::{
fixed_point::{self, FixedPoint},
fraction::Fraction,
rate,
time_int::TimeInt,
ConversionError,
Expand Down Expand Up @@ -181,7 +181,7 @@ pub use units::*;
/// ### Examples
///
/// ```rust
/// # use embedded_time::{fraction::Fraction, duration::*, duration::Generic};
/// use embedded_time::duration::*;
/// # use core::convert::{TryFrom, TryInto};
/// #
/// # let generic_duration = Generic::new(2_000_u32, Fraction::new(1, 1_000));
Expand All @@ -200,7 +200,7 @@ pub use units::*;
/// [`ConversionError::Unspecified`]
///
/// ```rust
/// # use embedded_time::{fraction::Fraction, duration::*, duration::Generic, ConversionError};
/// use embedded_time::{duration::*, ConversionError};
/// # use core::convert::TryFrom;
/// #
/// assert_eq!(
Expand All @@ -215,7 +215,7 @@ pub use units::*;
/// destination type fails.
///
/// ```rust
/// # use embedded_time::{fraction::Fraction, duration::*, duration::Generic, ConversionError};
/// use embedded_time::{duration::*, ConversionError};
/// # use core::convert::TryFrom;
/// #
/// assert_eq!(
Expand All @@ -227,7 +227,7 @@ pub use units::*;
/// ## Converting to a [`Generic`] `Duration`
///
/// ```rust
/// # use embedded_time::{fraction::Fraction, duration::*, duration::Generic};
/// use embedded_time::duration::*;
/// # use core::convert::{TryFrom, TryInto};
/// #
/// let generic_duration = Generic::<u32>::from(5_u32.seconds());
Expand Down
2 changes: 1 addition & 1 deletion src/rate.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Rate-based types/units
pub use crate::fraction::Fraction;
use crate::{
duration,
fixed_point::{self, FixedPoint},
fraction::Fraction,
time_int::{TimeInt, Widen},
ConversionError,
};
Expand Down

0 comments on commit 174610e

Please sign in to comment.