Skip to main content

ScalarDomainSpec

Struct ScalarDomainSpec 

Source
pub struct ScalarDomainSpec {
    pub domain: Symbol,
    pub numeric_family: &'static str,
    pub canonical_form: &'static str,
    pub parse_priority: i32,
}
Expand description

Static identity of a scalar number domain (data only).

A concrete domain crate fills this in once and derives its stable literal-class and instance-shape symbols from it, rather than spelling them out by hand.

§Examples

use sim_lib_numbers_core::{ScalarDomainSpec, domains};

let spec = ScalarDomainSpec {
    domain: domains::i64(),
    numeric_family: "integer",
    canonical_form: "i64",
    parse_priority: 20,
};
assert_eq!(spec.literal_class_symbol(), domains::literal_class("i64"));

Fields§

§domain: Symbol

The domain symbol, e.g. numbers/i64.

§numeric_family: &'static str

The numeric family label, e.g. "integer".

§canonical_form: &'static str

The canonical form label, e.g. "i64".

§parse_priority: i32

The literal parse priority.

Implementations§

Source§

impl ScalarDomainSpec

Source

pub fn matcher(&self) -> DomainLiteralMatcher

A literal matcher for this domain.

Source

pub fn literal_class_symbol(&self) -> Symbol

The literal class symbol, e.g. numbers/i64-literal.

Source

pub fn literal_instance_shape_symbol(&self) -> Symbol

The literal instance-shape symbol, e.g. numbers/i64-literal/instance-shape.

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> 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, 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.