pub enum TypeSpecification {
Show 14 variants
Boolean {
help: String,
},
Quantity {
minimum: Option<(Ratio<i128>, String)>,
maximum: Option<(Ratio<i128>, String)>,
decimals: Option<u8>,
units: QuantityUnits,
traits: Vec<QuantityTrait>,
decomposition: Option<BTreeMap<String, i32>>,
help: String,
},
Number {
minimum: Option<Ratio<i128>>,
maximum: Option<Ratio<i128>>,
decimals: Option<u8>,
help: String,
},
NumberRange {
help: String,
},
Ratio {
minimum: Option<Ratio<i128>>,
maximum: Option<Ratio<i128>>,
decimals: Option<u8>,
units: RatioUnits,
help: String,
},
RatioRange {
units: RatioUnits,
help: String,
},
Text {
length: Option<usize>,
options: Vec<String>,
help: String,
},
Date {
minimum: Option<DateTimeValue>,
maximum: Option<DateTimeValue>,
help: String,
},
DateRange {
help: String,
},
Time {
minimum: Option<TimeValue>,
maximum: Option<TimeValue>,
help: String,
},
TimeRange {
help: String,
},
QuantityRange {
units: QuantityUnits,
decomposition: Option<BTreeMap<String, i32>>,
help: String,
},
Veto {
message: Option<String>,
},
Undetermined,
}Variants§
Boolean
Quantity
Fields
units: QuantityUnitsdecomposition: Option<BTreeMap<String, i32>>Common dimensional decomposition vector shared by all units in this quantity.
None until the decomposition pass runs. Base quantities (no compound unit expression)
are assigned Some({quantity_name: 1}) by the pass. Some(empty_map) means resolved
to dimensionless (e.g. kg/kg).
Number
NumberRange
Ratio
Fields
units: RatioUnitsRatioRange
Text
Date
DateRange
Time
TimeRange
QuantityRange
Veto
Undetermined
Sentinel used during type inference when the type could not be determined. Propagates through expressions without generating cascading errors. Must never appear in a successfully validated graph or execution plan.
Implementations§
Source§impl TypeSpecification
impl TypeSpecification
pub fn boolean() -> Self
pub fn quantity() -> Self
pub fn number() -> Self
pub fn number_range() -> Self
pub fn ratio() -> Self
pub fn ratio_range() -> Self
pub fn text() -> Self
pub fn date() -> Self
pub fn date_range() -> Self
pub fn time() -> Self
pub fn time_range() -> Self
pub fn quantity_range() -> Self
Sourcepub fn element_from_range(&self) -> Option<Self>
pub fn element_from_range(&self) -> Option<Self>
Element spec for a range type (e.g. QuantityRange → Quantity).
Sourcepub fn range_from_element(&self) -> Option<Self>
pub fn range_from_element(&self) -> Option<Self>
Range spec for an element type (e.g. Quantity → QuantityRange).
Sourcepub fn minimum_decimal(&self) -> Option<Decimal>
pub fn minimum_decimal(&self) -> Option<Decimal>
Minimum bound as decimal for interactive numeric prompts (number, quantity, ratio).
Sourcepub fn maximum_decimal(&self) -> Option<Decimal>
pub fn maximum_decimal(&self) -> Option<Decimal>
Maximum bound as decimal for interactive numeric prompts (number, quantity, ratio).
pub fn veto() -> Self
Sourcepub fn apply_constraint(
self,
type_name: &str,
command: TypeConstraintCommand,
args: &[CommandArg],
declared_default: &mut Option<RawDefault>,
) -> Result<Self, String>
pub fn apply_constraint( self, type_name: &str, command: TypeConstraintCommand, args: &[CommandArg], declared_default: &mut Option<RawDefault>, ) -> Result<Self, String>
Apply a single constraint command to this spec.
The declared_default out-parameter receives the default value (if the command
is Default), encoded as [RawDefault]. Defaults are owned by the data binding
or typedef entry, not by the type specification itself; callers thread a single
&mut Option<RawDefault> across all constraint applications for one type so the
latest -> default command wins. Quantity scalars stay raw until unit factors
are resolved; callers materialize via [materialize_raw_default].
Trait Implementations§
Source§impl Clone for TypeSpecification
impl Clone for TypeSpecification
Source§fn clone(&self) -> TypeSpecification
fn clone(&self) -> TypeSpecification
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TypeSpecification
impl Debug for TypeSpecification
Source§impl<'de> Deserialize<'de> for TypeSpecification
impl<'de> Deserialize<'de> for TypeSpecification
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TypeSpecification
impl Display for TypeSpecification
impl Eq for TypeSpecification
Source§impl Hash for TypeSpecification
impl Hash for TypeSpecification
Source§impl PartialEq for TypeSpecification
impl PartialEq for TypeSpecification
Source§fn eq(&self, other: &TypeSpecification) -> bool
fn eq(&self, other: &TypeSpecification) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TypeSpecification
impl Serialize for TypeSpecification
impl StructuralPartialEq for TypeSpecification
Auto Trait Implementations§
impl Freeze for TypeSpecification
impl RefUnwindSafe for TypeSpecification
impl Send for TypeSpecification
impl Sync for TypeSpecification
impl Unpin for TypeSpecification
impl UnsafeUnpin for TypeSpecification
impl UnwindSafe for TypeSpecification
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,
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<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