Add #![feature] attributes to doctests
This commit is contained in:
parent
df290f127e
commit
e9019101a8
107 changed files with 649 additions and 22 deletions
|
|
@ -60,6 +60,7 @@ impl Rand for Exp1 {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand;
|
||||
/// use std::rand::distributions::{Exp, IndependentSample};
|
||||
///
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ use super::{IndependentSample, Sample, Exp};
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand;
|
||||
/// use std::rand::distributions::{IndependentSample, Gamma};
|
||||
///
|
||||
|
|
@ -187,6 +188,7 @@ impl IndependentSample<f64> for GammaLargeShape {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand;
|
||||
/// use std::rand::distributions::{ChiSquared, IndependentSample};
|
||||
///
|
||||
|
|
@ -244,6 +246,7 @@ impl IndependentSample<f64> for ChiSquared {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand;
|
||||
/// use std::rand::distributions::{FisherF, IndependentSample};
|
||||
///
|
||||
|
|
@ -288,6 +291,7 @@ impl IndependentSample<f64> for FisherF {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand;
|
||||
/// use std::rand::distributions::{StudentT, IndependentSample};
|
||||
///
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ pub struct Weighted<T> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand;
|
||||
/// use std::rand::distributions::{Weighted, WeightedChoice, IndependentSample};
|
||||
///
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ impl Rand for StandardNormal {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand;
|
||||
/// use std::rand::distributions::{Normal, IndependentSample};
|
||||
///
|
||||
|
|
@ -124,6 +125,7 @@ impl IndependentSample<f64> for Normal {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand;
|
||||
/// use std::rand::distributions::{LogNormal, IndependentSample};
|
||||
///
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ use distributions::{Sample, IndependentSample};
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::distributions::{IndependentSample, Range};
|
||||
///
|
||||
/// fn main() {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ pub trait Rng : Sized {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand, core)]
|
||||
/// use std::rand::{thread_rng, Rng};
|
||||
///
|
||||
/// let mut v = [0; 13579];
|
||||
|
|
@ -184,6 +185,7 @@ pub trait Rng : Sized {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{thread_rng, Rng};
|
||||
///
|
||||
/// let mut rng = thread_rng();
|
||||
|
|
@ -202,6 +204,7 @@ pub trait Rng : Sized {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{thread_rng, Rng};
|
||||
///
|
||||
/// let mut rng = thread_rng();
|
||||
|
|
@ -229,6 +232,7 @@ pub trait Rng : Sized {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{thread_rng, Rng};
|
||||
///
|
||||
/// let mut rng = thread_rng();
|
||||
|
|
@ -247,6 +251,7 @@ pub trait Rng : Sized {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{thread_rng, Rng};
|
||||
///
|
||||
/// let mut rng = thread_rng();
|
||||
|
|
@ -261,6 +266,7 @@ pub trait Rng : Sized {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{thread_rng, Rng};
|
||||
///
|
||||
/// let s: String = thread_rng().gen_ascii_chars().take(10).collect();
|
||||
|
|
@ -277,6 +283,7 @@ pub trait Rng : Sized {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{thread_rng, Rng};
|
||||
///
|
||||
/// let choices = [1, 2, 4, 8, 16, 32];
|
||||
|
|
@ -297,6 +304,7 @@ pub trait Rng : Sized {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand, core)]
|
||||
/// use std::rand::{thread_rng, Rng};
|
||||
///
|
||||
/// let mut rng = thread_rng();
|
||||
|
|
@ -360,6 +368,7 @@ pub trait SeedableRng<Seed>: Rng {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{Rng, SeedableRng, StdRng};
|
||||
///
|
||||
/// let seed: &[_] = &[1, 2, 3, 4];
|
||||
|
|
@ -375,6 +384,7 @@ pub trait SeedableRng<Seed>: Rng {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{Rng, SeedableRng, StdRng};
|
||||
///
|
||||
/// let seed: &[_] = &[1, 2, 3, 4];
|
||||
|
|
@ -480,6 +490,7 @@ impl Rand for XorShiftRng {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{random, Open01};
|
||||
///
|
||||
/// let Open01(val) = random::<Open01<f32>>();
|
||||
|
|
@ -497,6 +508,7 @@ pub struct Open01<F>(pub F);
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{random, Closed01};
|
||||
///
|
||||
/// let Closed01(val) = random::<Closed01<f32>>();
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R> + Default>
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rand)]
|
||||
/// use std::rand::{Rng, SeedableRng, StdRng};
|
||||
/// use std::rand::reseeding::{Reseeder, ReseedingRng};
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue