pub enum MeasureName {
Normal,
Exponential,
Pareto,
Beta,
LogNormal,
Gamma,
Uniform01,
}Expand description
Named continuous distribution. A closed enum, per comprehension_forms.md §10.7.5’s “User-defined extensions” non-goal: a new distribution is a coordinated addition to it.
Variants§
Normal
The normal distribution.
Exponential
The exponential distribution.
Pareto
The Pareto distribution.
Beta
The beta distribution.
LogNormal
The log-normal distribution.
Gamma
The gamma distribution.
Uniform01
The uniform distribution on [0, 1].
Implementations§
Source§impl MeasureName
impl MeasureName
Sourcepub fn is_proper_probability_measure(self) -> bool
pub fn is_proper_probability_measure(self) -> bool
All currently-named distributions are proper probability measures (unit total mass). V8 accepts them on any interval that matches the distribution’s support.
Sourcepub fn parameter_names(self) -> &'static [&'static str]
pub fn parameter_names(self) -> &'static [&'static str]
The distribution’s parameters, in the order a
Source::Distribution’s params lists them:
| Measure | Parameters | Support |
|---|---|---|
Normal | mean, stddev | (-∞, ∞) |
Exponential | rate | [0, ∞) |
Pareto | scale, shape | [scale, ∞) |
Beta | alpha, beta | [0, 1] |
LogNormal | mean, stddev (of the log) | (0, ∞) |
Gamma | shape, scale | [0, ∞) |
Uniform01 | none | [0, 1] |
Sourcepub fn default_params(self) -> &'static [f64]
pub fn default_params(self) -> &'static [f64]
The standard parameters, used when a source names the
measure without parameters: Normal(0, 1), Exponential(1),
Pareto(1, 1), Beta(1, 1), LogNormal(0, 1), Gamma(1, 1).
Sourcepub fn resolve_params(self, params: &[f64]) -> Result<Vec<f64>, String>
pub fn resolve_params(self, params: &[f64]) -> Result<Vec<f64>, String>
The parameters as the sampler takes them: params when it
has the measure’s count, the standard parameters when it is
empty, and an error naming the expected parameters otherwise.
Sourcepub fn text(self) -> &'static str
pub fn text(self) -> &'static str
The measure’s name in comprehension source text, the spelling
a clause writes: normal(0, 1), log_normal(0, 0.5).
Sourcepub fn from_text(name: &str) -> Option<MeasureName>
pub fn from_text(name: &str) -> Option<MeasureName>
The measure a source-text name denotes, or None when the
name is not one of the closed set (comprehension_forms.md
§10.7.5): the caller reads
the text as something else, a generator call for one.
Trait Implementations§
Source§impl Clone for MeasureName
impl Clone for MeasureName
Source§fn clone(&self) -> MeasureName
fn clone(&self) -> MeasureName
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MeasureName
Source§impl Debug for MeasureName
impl Debug for MeasureName
Source§impl<'de> Deserialize<'de> for MeasureName
impl<'de> Deserialize<'de> for MeasureName
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MeasureName, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MeasureName, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for MeasureName
Source§impl Hash for MeasureName
impl Hash for MeasureName
Source§impl PartialEq for MeasureName
impl PartialEq for MeasureName
Source§impl Serialize for MeasureName
impl Serialize for MeasureName
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for MeasureName
Auto Trait Implementations§
impl Freeze for MeasureName
impl RefUnwindSafe for MeasureName
impl Send for MeasureName
impl Sync for MeasureName
impl Unpin for MeasureName
impl UnsafeUnpin for MeasureName
impl UnwindSafe for MeasureName
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more