2016-04-26 12:51:14 -05:00
|
|
|
pub struct Closed01<F>(pub F);
|
|
|
|
|
|
|
|
pub trait Bar { fn new() -> Self; }
|
|
|
|
|
|
|
|
impl<T: Bar> Bar for Closed01<T> {
|
|
|
|
fn new() -> Closed01<T> { Closed01(Bar::new()) }
|
2015-03-18 16:05:24 -05:00
|
|
|
}
|
2016-04-26 12:51:14 -05:00
|
|
|
impl Bar for f32 { fn new() -> f32 { 1.0 } }
|
|
|
|
|
|
|
|
pub fn random<T: Bar>() -> T { Bar::new() }
|