pub enum Family {
Normal {
mean: f64,
sd: f64,
},
Lognormal {
mu: f64,
sigma: f64,
},
Uniform {
lo: f64,
hi: f64,
},
Beta {
a: f64,
b: f64,
},
Gamma {
shape: f64,
scale: f64,
},
Exponential {
rate: f64,
},
Triangular {
lo: f64,
mode: f64,
hi: f64,
},
Pert {
lo: f64,
mode: f64,
hi: f64,
},
}Expand description
A continuous distribution.
Variants§
Normal
Lognormal
Uniform
Beta
Gamma
Exponential
Triangular
Pert
A beta distribution stretched over lo..hi with its mode at mode.
Implementations§
Source§impl Family
impl Family
pub fn normal(mean: f64, sd: f64) -> OpResult<Family>
pub fn lognormal(mu: f64, sigma: f64) -> OpResult<Family>
pub fn uniform(lo: f64, hi: f64) -> OpResult<Family>
pub fn beta(a: f64, b: f64) -> OpResult<Family>
pub fn gamma(shape: f64, scale: f64) -> OpResult<Family>
pub fn exponential(rate: f64) -> OpResult<Family>
pub fn triangular(lo: f64, mode: f64, hi: f64) -> OpResult<Family>
pub fn pert(lo: f64, mode: f64, hi: f64) -> OpResult<Family>
Sourcepub fn estimate(a: f64, b: f64) -> OpResult<Family>
pub fn estimate(a: f64, b: f64) -> OpResult<Family>
a to b: the lognormal whose 5% and 95% quantiles are a and b.
Sourcepub fn normal_range(lo: f64, hi: f64) -> OpResult<Family>
pub fn normal_range(lo: f64, hi: f64) -> OpResult<Family>
normal_range(lo, hi): the normal whose 5% and 95% quantiles are
lo and hi.
pub fn mean(&self) -> f64
pub fn variance(&self) -> f64
pub fn sd(&self) -> f64
Sourcepub fn interval_moments(&self, lo: f64, hi: f64) -> (f64, f64)
pub fn interval_moments(&self, lo: f64, hi: f64) -> (f64, f64)
Conditional moments on a nonempty interval, using incomplete moments. Uniform and normal use centered formulas to avoid subtracting large location parameters when computing the variance.
pub fn pdf(&self, x: f64) -> f64
Sourcepub fn quantile(&self, p: f64) -> f64
pub fn quantile(&self, p: f64) -> f64
The value below which a share p of the distribution lies.
pub fn name(&self) -> &'static str
Trait Implementations§
impl Copy for Family
impl StructuralPartialEq for Family
Auto Trait Implementations§
impl Freeze for Family
impl RefUnwindSafe for Family
impl Send for Family
impl Sync for Family
impl Unpin for Family
impl UnsafeUnpin for Family
impl UnwindSafe for Family
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);