Skip to content

Commit 0af9ee5

Browse files
committed
move docstrings to inline comments
- also hide the count! macro, since it is only used as a helper
1 parent 3d3eebb commit 0af9ee5

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

plotters/blub.png

Lines changed: 3 additions & 0 deletions
Loading

plotters/src/style/colors/colormaps.rs

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,19 @@ macro_rules! calculate_new_color_value(
8181
};
8282
);
8383

84-
/// Helper function to calculate the lower and upper index nearest to a provided float value.
85-
///
86-
/// Used to obtain colors from a colorscale given a value h between 0.0 and 1.0.
87-
/// It also returns the relative difference which can then be used to calculate a linear interpolation between the two nearest colors.
88-
/// ```
89-
/// # use plotters::prelude::*;
90-
/// let r = calculate_relative_difference_index_lower_upper(1.2, 1.0, 3.0, 4);
91-
/// let (relative_difference, lower_index, upper_index) = r;
92-
///
93-
/// assert_eq!(relative_difference, 0.7000000000000001);
94-
/// assert_eq!(lower_index, 0);
95-
/// assert_eq!(upper_index, 1);
96-
/// ```
84+
// Helper function to calculate the lower and upper index nearest to a provided float value.
85+
//
86+
// Used to obtain colors from a colorscale given a value h between 0.0 and 1.0.
87+
// It also returns the relative difference which can then be used to calculate a linear interpolation between the two nearest colors.
88+
// ```
89+
// # use plotters::prelude::*;
90+
// let r = calculate_relative_difference_index_lower_upper(1.2, 1.0, 3.0, 4);
91+
// let (relative_difference, lower_index, upper_index) = r;
92+
//
93+
// assert_eq!(relative_difference, 0.7000000000000001);
94+
// assert_eq!(lower_index, 0);
95+
// assert_eq!(upper_index, 1);
96+
// ```
9797
#[doc(hidden)]
9898
pub fn calculate_relative_difference_index_lower_upper<
9999
FloatType: num_traits::Float + num_traits::FromPrimitive + num_traits::ToPrimitive,
@@ -148,25 +148,22 @@ macro_rules! implement_color_scale_for_derived_color_map{
148148

149149
implement_color_scale_for_derived_color_map! {RGBAColor, RGBColor, HSLColor}
150150

151-
#[doc(inline)]
152-
pub use crate::count;
153-
154151
#[macro_export]
155152
#[doc(hidden)]
156-
/// Counts the number of arguments which are separated by spaces
157-
///
158-
/// This macro is used internally to determine the size of an array to hold all new colors.
159-
/// ```
160-
/// # use plotters::count;
161-
/// let counted = count!{Plotting is fun};
162-
/// assert_eq!(counted, 3);
163-
///
164-
/// let counted2 = count!{0_usize was my favourite 1_f64 last century};
165-
/// assert_eq!(counted2, 7);
166-
///
167-
/// let new_array = ["Hello"; count!(Plotting is fun)];
168-
/// assert_eq!(new_array, ["Hello"; 3]);
169-
/// ```
153+
// Counts the number of arguments which are separated by spaces
154+
//
155+
// This macro is used internally to determine the size of an array to hold all new colors.
156+
// ```
157+
// # use plotters::count;
158+
// let counted = count!{Plotting is fun};
159+
// assert_eq!(counted, 3);
160+
//
161+
// let counted2 = count!{0_usize was my favourite 1_f64 last century};
162+
// assert_eq!(counted2, 7);
163+
//
164+
// let new_array = ["Hello"; count!(Plotting is fun)];
165+
// assert_eq!(new_array, ["Hello"; 3]);
166+
// ```
170167
macro_rules! count {
171168
() => (0usize);
172169
($x:tt $($xs:tt)* ) => (1usize + $crate::count!($($xs)*));

0 commit comments

Comments
 (0)