@@ -53,29 +53,29 @@ use distributions::float::IntoFloat;
5353/// ```
5454#[ derive( Clone , Copy , Debug ) ]
5555pub struct Range < X : SampleRange > {
56- inner : X :: T ,
56+ inner : X :: Impl ,
5757}
5858
5959impl < X : SampleRange > Range < X > {
6060 /// Create a new `Range` instance which samples uniformly from the half
6161 /// open range `[low, high)` (excluding `high`). Panics if `low >= high`.
6262 pub fn new ( low : X , high : X ) -> Range < X > {
6363 assert ! ( low < high, "Range::new called with `low >= high`" ) ;
64- Range { inner : X :: T :: new ( low, high) }
64+ Range { inner : X :: Impl :: new ( low, high) }
6565 }
6666
6767 /// Create a new `Range` instance which samples uniformly from the closed
6868 /// range `[low, high]` (inclusive). Panics if `low >= high`.
6969 pub fn new_inclusive ( low : X , high : X ) -> Range < X > {
7070 assert ! ( low < high, "Range::new called with `low >= high`" ) ;
71- Range { inner : X :: T :: new_inclusive ( low, high) }
71+ Range { inner : X :: Impl :: new_inclusive ( low, high) }
7272 }
7373
7474 /// Sample a single value uniformly from `[low, high)`.
7575 /// Panics if `low >= high`.
7676 pub fn sample_single < R : Rng + ?Sized > ( low : X , high : X , rng : & mut R ) -> X {
7777 assert ! ( low < high, "Range::sample_single called with low >= high" ) ;
78- X :: T :: sample_single ( low, high, rng)
78+ X :: Impl :: sample_single ( low, high, rng)
7979 }
8080}
8181
@@ -88,8 +88,8 @@ impl<X: SampleRange> Distribution<X> for Range<X> {
8888/// Helper trait for creating objects using the correct implementation of
8989/// `RangeImpl` for the sampling type; this enables `Range::new(a, b)` to work.
9090pub trait SampleRange : PartialOrd +Sized {
91- /// Actual `RangeImpl` implementation for `X`.
92- type T : RangeImpl < X = Self > ;
91+ /// The `RangeImpl` implementation supporting type `X`.
92+ type Impl : RangeImpl < X = Self > ;
9393}
9494
9595/// Helper trait handling actual range sampling.
@@ -125,7 +125,7 @@ pub trait SampleRange: PartialOrd+Sized {
125125/// }
126126///
127127/// impl SampleRange for MyF32 {
128- /// type T = RangeMyF32;
128+ /// type Impl = RangeMyF32;
129129/// }
130130///
131131/// let (low, high) = (MyF32(17.0f32), MyF32(22.0f32));
@@ -184,7 +184,7 @@ macro_rules! range_int_impl {
184184 ( $ty: ty, $signed: ty, $unsigned: ident,
185185 $i_large: ident, $u_large: ident) => {
186186 impl SampleRange for $ty {
187- type T = RangeInt <$ty>;
187+ type Impl = RangeInt <$ty>;
188188 }
189189
190190 impl RangeImpl for RangeInt <$ty> {
@@ -429,7 +429,7 @@ pub struct RangeFloat<X> {
429429macro_rules! range_float_impl {
430430 ( $ty: ty, $bits_to_discard: expr, $next_u: ident) => {
431431 impl SampleRange for $ty {
432- type T = RangeFloat <$ty>;
432+ type Impl = RangeFloat <$ty>;
433433 }
434434
435435 impl RangeImpl for RangeFloat <$ty> {
@@ -567,7 +567,7 @@ mod tests {
567567 }
568568 }
569569 impl SampleRange for MyF32 {
570- type T = RangeMyF32 ;
570+ type Impl = RangeMyF32 ;
571571 }
572572
573573 let ( low, high) = ( MyF32 { x : 17.0f32 } , MyF32 { x : 22.0f32 } ) ;
0 commit comments