Skip to content

Clean up imports, fix doc lints, get doctests to pass #59

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
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 2 additions & 3 deletions src/density.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub const LBCF_KGCM_FACTOR: f64 = 0.062427973725314;
/// let mans_weight = Mass::from_stones(12.0);
/// let water_volume = mans_weight / body_density;
/// println!("{} gallons of water spilled on the floor", water_volume.as_gallons());
///}
/// }
/// ```
/// # Example2 - converting to ad-hoc units of density
///
Expand All @@ -40,9 +40,8 @@ pub const LBCF_KGCM_FACTOR: f64 = 0.062427973725314;
/// let density: Density = Mass::from_grams(3.0) / Volume:: from_litres(1.0);
/// let ounces = (density * Volume::from_quarts(1.0)).as_ounces();
/// println!("Answer is {} ounces per quart", ounces);
///}
/// }
/// ```

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, Debug, Default)]
pub struct Density {
Expand Down
20 changes: 8 additions & 12 deletions src/measurement.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/// The `Measurement` trait and the `implement_measurement!` macro
/// provides a common way for various measurements to be implemented.
//! The `Measurement` trait and the `implement_measurement!` macro
//! provides a common way for various measurements to be implemented.
///
/// All measurements implement this.
///
/// It provides conversion functions to and from raw numbers.
///
/// # Example
/// ```
/// #![no_std]
/// // Importing the `implement_measurement` macro from the external crate is important
/// #[macro_use]
/// extern crate measurements;
Expand Down Expand Up @@ -35,16 +38,9 @@
/// // You should't need it in your own code.
/// fn main() { }
/// ```

#[cfg(feature = "no-std")]
use core as std;

#[cfg(feature = "no-std")]
use core::num::Float;

/// All measurements implement this.
///
/// It provides conversion functions to and from raw numbers.
/// *Note*: If you are in a `no_std` environment, you have to
/// `use core as std;` for the macros to run.
pub trait Measurement {
/// Returns a string containing the most appropriate units for this quantity,
/// and a floating point value representing this quantity in those units.
Expand Down
Loading