Skip to content
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

fix no_std #127

Merged
merged 4 commits into from Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion palette/src/blend/blend.rs
@@ -1,6 +1,6 @@
use num_traits::{One, Zero};
use float::Float;
#[cfg(feature = "libm_works")]
#[cfg(not(feature = "std"))]
use num_traits::float::FloatCore;

use {cast, clamp, ComponentWise};
Expand Down
2 changes: 1 addition & 1 deletion palette/src/blend/equations.rs
@@ -1,5 +1,5 @@
use float::Float;
#[cfg(feature = "libm_works")]
#[cfg(not(feature = "std"))]
use num_traits::float::FloatCore;

use {Blend, ComponentWise};
Expand Down
8 changes: 5 additions & 3 deletions palette/src/convert.rs
Expand Up @@ -352,10 +352,12 @@ where
///
/// use palette::{Component, Hsv, IntoColor, Pixel, Srgb};
/// use palette::rgb::{Rgb, RgbSpace};
/// use palette::encoding::Linear;
/// use palette::encoding::{Linear, self};
/// use palette::white_point::D65;
/// use palette::float::Float;
///
/// type Hsv64 = Hsv<encoding::Srgb, f64>;
///
/// /// sRGB, but with a reversed memory layout.
/// #[derive(Copy, Clone, IntoColor, Pixel)]
/// #[palette_manual_into(Rgb = "into_rgb_internal")]
Expand Down Expand Up @@ -391,7 +393,7 @@ where
/// 0.7353569830524495,
/// 0.5370987304831942,
/// ];
/// let hsv = Bgr::from_raw_slice(&buffer)[1].into();
/// let hsv: Hsv64 = Bgr::from_raw_slice(&buffer)[1].into();
///
/// assert_relative_eq!(hsv, Hsv::new(90.0, 1.0, 0.5));
/// }
Expand Down Expand Up @@ -441,7 +443,7 @@ where
/// blue: 255,
/// alpha: 0.3,
/// };
/// let color = css_color.into();
/// let color: LinSrgba = css_color.into();
///
/// assert_relative_eq!(color, LinSrgba::new(0.496933, 0.0, 1.0, 0.3));
/// }
Expand Down
5 changes: 3 additions & 2 deletions palette/src/float.rs
Expand Up @@ -9,12 +9,13 @@
//!
//! [`libm`]: https://github.com/japaric/libm

#[cfg(feature = "std")]
pub use num_traits::Float;

#[cfg(feature = "libm_works")]
#[cfg(not(feature = "std"))]
pub use self::no_std_float_trait::Float;

#[cfg(feature = "libm_works")]
#[cfg(not(feature = "std"))]
mod no_std_float_trait {
extern crate libm;
use self::libm::{F32Ext, F64Ext};
Expand Down
4 changes: 2 additions & 2 deletions scripts/test_features.sh
Expand Up @@ -36,10 +36,10 @@ echo -e "features: $features\n"

#Test without any optional feature
echo testing with --no-default-features --features "$required_features"
cargo test --no-default-features --features "$required_features"
cargo test --release --no-default-features --features "$required_features"

#Isolated test of each optional feature
for feature in $features; do
echo testing with --no-default-features --features "\"$feature $required_features\""
cargo test --no-default-features --features "$feature $required_features"
cargo test --release --no-default-features --features "$feature $required_features"
done