Enum LogosType
pub enum LogosType {
Show 27 variants
Int,
Float,
Bool,
Char,
Byte,
String,
Unit,
Seq(Box<LogosType>),
Map(Box<LogosType>, Box<LogosType>),
Set(Box<LogosType>),
Option(Box<LogosType>),
Duration,
Date,
Moment,
Time,
Span,
Nat,
Rational,
Decimal,
Complex,
Modular,
Quantity,
Money,
Uuid,
UserDefined(Symbol),
Function(Vec<LogosType>, Box<LogosType>),
Unknown,
}Expand description
Structured type representation for LOGOS values.
Replaces string-based type tracking (e.g., "Vec<i64>", "String")
with a proper algebraic data type that supports precise queries.
Variants§
Int
Float
Bool
Char
Byte
String
Unit
Seq(Box<LogosType>)
Map(Box<LogosType>, Box<LogosType>)
Set(Box<LogosType>)
Option(Box<LogosType>)
Duration
Date
Moment
Time
Span
Nat
Rational
Exact rational (logicaffeine_base::Rational). A Rational-typed binding keeps
division exact (7 / 2 → 7/2) where a bare Int floors. Lowers to LogosRational.
Decimal
Exact base-10 fixed-point (money). + − × stay exact Decimal (scale preserved);
÷ widens to Rational. Built via decimal("19.99"). Lowers to LogosDecimal.
Complex
Exact complex number re + im·i. + − × ÷ stay Complex (closed field). Built via
complex(re, im). NOT ordered. Lowers to LogosComplex.
Modular
An element of the ring ℤ/nℤ. + − × ÷ stay Modular (same modulus required, no
auto-lift). Built via modular(value, modulus). NOT ordered. Lowers to LogosModular.
Quantity
A dimensioned physical quantity (quantity(2, "inch")). + − require the same dimension,
× ÷ combine dimensions, and it may be scaled by a number; built via quantity/convert.
The magnitude rides the exact rational tower. Lowers to LogosQuantity. Dimension safety is
enforced at runtime (a clean error), like Modular’s ring check.
Money
An exact monetary amount in a currency (money(19.99, "USD") / 19.99 USD). + − require
the same currency, × ÷ scale by a number; the amount rides the Decimal tower. Lowers to
LogosMoney. Currency safety is enforced at runtime (a clean error), like Quantity.
Uuid
A 128-bit UUID (uuid "…", a random uuid). An opaque identifier — no arithmetic; lowers to
LogosUuid. Comparable/orderable by its bytes.
UserDefined(Symbol)
Function(Vec<LogosType>, Box<LogosType>)
First-class function type: fn(P1, P2, …) -> R
Unknown
Implementations§
§impl LogosType
impl LogosType
pub fn is_copy(&self) -> bool
pub fn is_copy(&self) -> bool
Whether this type is Copy in Rust (no .clone() needed).
This is the single source of truth for clone decisions,
replacing is_copy_type(), has_copy_element_type(), has_copy_value_type().
pub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Whether this type is numeric (Int or Float).
pub fn element_type(&self) -> Option<&LogosType>
pub fn element_type(&self) -> Option<&LogosType>
Get the element type for sequences and sets.
pub fn value_type(&self) -> Option<&LogosType>
pub fn value_type(&self) -> Option<&LogosType>
Get the value type for maps.
pub fn numeric_promotion(a: &LogosType, b: &LogosType) -> LogosType
pub fn numeric_promotion(a: &LogosType, b: &LogosType) -> LogosType
Numeric promotion: Z embeds into R. If either operand is Float, the result is Float. If both are Int (or Nat), the result is Int.
pub fn to_rust_type(&self) -> String
pub fn to_rust_type(&self) -> String
Convert to the Rust type string used in codegen output.
Replaces all ad-hoc string-based type conversions scattered across codegen.rs. This is the single point of truth for LogosType → Rust type string mapping.
pub fn from_type_expr(ty: &TypeExpr<'_>, interner: &Interner) -> LogosType
pub fn from_type_expr(ty: &TypeExpr<'_>, interner: &Interner) -> LogosType
Build a LogosType from a TypeExpr AST node.
pub fn from_rust_type_str(s: &str) -> LogosType
pub fn from_rust_type_str(s: &str) -> LogosType
Parse a Rust type string back into a LogosType (legacy bridge).
Handles strings like “i64”, “f64”, “String”, “Vec
pub fn from_literal(lit: &Literal) -> LogosType
pub fn from_literal(lit: &Literal) -> LogosType
Infer a LogosType from a literal expression.
Trait Implementations§
impl Eq for LogosType
impl StructuralPartialEq for LogosType
Auto Trait Implementations§
impl Freeze for LogosType
impl RefUnwindSafe for LogosType
impl Send for LogosType
impl Sync for LogosType
impl Unpin for LogosType
impl UnsafeUnpin for LogosType
impl UnwindSafe for LogosType
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.