mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
11 lines
249 B
Rust
11 lines
249 B
Rust
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()) }
|
|
}
|
|
impl Bar for f32 { fn new() -> f32 { 1.0 } }
|
|
|
|
pub fn random<T: Bar>() -> T { Bar::new() }
|