Skip to main content

Preset

Struct Preset 

pub struct Preset {
    name: &'static str,
    measure: Measure,
    default_scale: Scale,
}
Expand description

A named risk measure: the point it names, and the scale it reports in when asked for by name.

Fields§

§name: &'static str§measure: Measure§default_scale: Scale

Implementations§

§

impl Preset

pub fn name(&self) -> &'static str

The name a caller writes and a report row is keyed by.

pub fn measure(&self) -> Measure

The point in measure space it names, with no stated scale.

pub fn default_scale(&self) -> Scale

The scale it reports in when asked for by name and nothing else states one.

pub fn asset_class(&self) -> Option<AssetClass>

The asset class it is filed under — its axis’s, so the two cannot disagree. None for NPV, which belongs to every desk.

pub fn how(&self) -> How

How it is computed.

pub fn requires(&self) -> &'static str

What the market must hold beyond the curves the trades price on, in words — empty where it needs nothing more.

pub fn per(&self, scale: Scale) -> Request

This preset restated at scale: the same name, a stated scale.

pub fn of_class(class: AssetClass) -> impl Iterator<Item = &'static Preset>

The presets filed under class, in table order.

§

impl Preset

pub const ALL: &'static [Preset]

Every preset, in catalogue order.

pub const ACCEPTED: &'static [&'static str]

Every preset’s name, in catalogue order — what a rejection lists.

Trait Implementations§

§

impl Clone for Preset

§

fn clone(&self) -> Preset

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for Preset

§

impl Debug for Preset

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Display for Preset

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Eq for Preset

§

impl From<&Preset> for Request

§

fn from(preset: &Preset) -> Self

Converts to this type from the input type.
§

impl From<Preset> for Request

§

fn from(preset: Preset) -> Self

Converts to this type from the input type.
§

impl FromStr for Preset

A preset by name. Case and _/- are not significant, as for every other named vocabulary; the rejection lists the table.

§

type Err = VocabularyParseError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for Preset

§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for Preset

§

fn eq(&self, other: &Preset) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for Preset

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.