Skip to main content

Ty

Enum Ty 

Source
pub enum Ty {
Show 18 variants Int, Float, Bool, String, Content, Divert, List(String), Array(Box<Ty>), Map(Box<Ty>, Box<Ty>), Struct(String), Fn(Vec<Ty>, Box<Ty>, FnRow), Handle(String), Option(Box<Ty>), Range { non_empty: bool, }, Weighted(Box<Ty>), Tower(TowerTy), Unknown, Conflicted,
}
Expand description

A type in the checker’s universe (typed-mode-spec §2).

Variants§

§

Int

§

Float

§

Bool

§

String

§

Content

A first-class content value (issue #1846, docs/prose-dialect-spec.md §3.5b’s capture contract): the type of a content-typed parameter, e.g. fn radio(chan: string, text: content). Backed by the existing fragment-capture path (BeginFragmentEndFragmentValue::FragmentRef, brink_format::Opcode) — the same machinery an ordinary call embedded in display position already composes through (brink-codegen-inkb::content::emit_slot_expr). Deliberately a distinct nominal leaf, not unified or coerced with Ty::String: the whole reason content exists is that a captured prose run stays translation-resident and measurable through the normal line path (docs/decision-log.md 2026-07-31 ruling) — silently flattening it to a plain string would defeat that. This variant is the type-resolution prerequisite only; the dispatch mechanism that actually binds a captured run to a content param (@[element(args = "…", block)]’s block capture) is issue #1839’s scope, not this one’s.

§

Divert

A divert target value (-> knot used as a value, not a jump).

§

List(String)

A LIST value, nominal per the declaring LIST name (spec §2: “nominal per LIST declaration”).

§

Array(Box<Ty>)

#[...] array sigil literal element type.

§

Map(Box<Ty>, Box<Ty>)

#{...} map sigil literal key/value types.

§

Struct(String)

A struct value, nominal per the declaring STRUCT name (TM-4b, docs/typed-mode-spec.md §6 — mirrors List’s “nominal per LIST declaration” precedent). Carries only the shape name in this slice — no field-type table is threaded through inference yet (TM-4c/codegen concern); a struct-typed slot is still concrete for E065/E066 escape-checking purposes (brink-analyzer::strict::classify).

§

Fn(Vec<Ty>, Box<Ty>, FnRow)

A function value’s type, fn(T…): R (T1c, docs/t1c-spec.md §4; typed-mode-spec §3 reserved the written form). The param row is val-only by construction: every ref param of the target is bound away at #fn creation (all refs must bind in the prefix, E080), so the type form carries no modes — a Ty::Fn row describes exactly the remaining (unbound) params a call through the value must supply.

The third component is the effect row riding the type (docs/effects-spec.md §5, issue #1680 step 3) — see FnRow. It is joined by unify alongside the params and the return, and is deliberately not part of assignability: see assignable.

§

Handle(String)

A host-resource handle value, nominal per its manifest-declared kind name (T1d-2, docs/t1d-spec.md §3: Handle<K> — mirrors List’s “nominal per LIST declaration” precedent, but the vocabulary lives in the external manifest, not ink source). Two handle types unify only when the kind names match exactly; a cross-kind pair is a genuine structural mismatch and joins to Conflicted (#627 lattice) — a binding declared Handle<AudioInstance> and one declared Handle<Timer> are as incompatible as int and string.

§

Option(Box<Ty>)

Option<T> — the third compiler-known parameterized builtin (NS-A1, docs/stdlib-spec.md §1.4, ruled 2026-07-18), joining Array/Map in the static type language. A compiler-owned enum shape (none / some(T)), NOT user generics (#1090’s door stays shut). Unifies pointwise on the element like Array; against any non-Option concrete type it is a genuine structural mismatch — the ruled Option<T> ≠ T strictness IS the Conflicted join (display-boundary forgiveness is Track B4 and deliberately absent from this lattice).

§

Range

An integer range value (NS-A5, docs/stdlib-spec.md §7 — F7 ruled 2026-07-19: ranges are a real Value kind). The non_empty flag is the language’s first value refinement: true is checker-minted EVIDENCE that the range denotes at least one element — a refined view over the same runtime value, never a second value kind. The checker mints it in exactly two places (the closed-refinement doctrine): a range literal with provably-inhabited bounds, and the some payload of non_empty(r). Under gradual typing the flag is inert (F8 — the runtime fault is the residual); under types = strict rand::int demands it (E117).

Fields

§non_empty: bool

Checker-minted inhabitedness evidence (NonEmptyRange, the S2 spelling). Joins with && in unify: evidence survives only if EVERY observed source carries it.

§

Weighted(Box<Ty>)

Not (yet) resolved to a concrete type — legal in this slice (spec Weighted<T> — the weighted table builtin (NS-A7, docs/stdlib-spec.md §8): compiler-known and parameterized like Option/Array, NOT user generics. Unifies pointwise on the value element; against any other concrete type it is a genuine structural mismatch (Conflicted). v1 is construct-and-roll — the only producer is the weighted(…) intrinsic, the only consumer roll.

§

Tower(TowerTy)

A numeric-tower value kind (NS-A8, docs/tower-mini-spec.md): vec2/vec3/vec4/quat/mat2/mat3/mat4 — seven closed compiler-known kinds carried by one variant (they behave identically in the lattice: nominal scalar-like leaves; no coercion into or out of them, so a tower-vs-anything-else join is Conflicted).

§

Unknown

§2: “unresolved -> Unknown, which is LEGAL”). Acts as the join identity: unify(Unknown, x) == x.

§

Conflicted

A genuine, irreconcilable type conflict was observed for this slot (e.g. used as both int and string) — #627 ruling. A distinct absorbing lattice point, not a synonym for Unknown: unify(Conflicted, x) == Conflicted for every x (including Unknown), so a conflict can never silently “heal” back to a concrete type depending on the order observations arrive in. Gradual mode (every consumer today) treats it exactly like Unknown — strict mode’s TM-3 (#619) is the slice that reports it as a diagnostic; this lattice point only exists so that reporting can be order-independent when it lands.

Implementations§

Source§

impl Ty

Source

pub fn display(&self) -> String

Human-readable name, for future hover/diagnostic surfacing (TM-5).

Source

pub fn is_unknown(&self) -> bool

Source

pub fn is_conflicted(&self) -> bool

Source

pub fn is_unresolved(&self) -> bool

Gradual/advisory consumers’ view (#627 ruling: “Conflicted like Unknown, zero behavior change today”) — a slot that is either unconstrained or genuinely conflicted carries no usable concrete type for a consumer that isn’t strict-mode’s TM-3 conflict reporter. Strict mode (#619) is the one place these two must stay distinguished; every other consumer should read this instead of is_unknown().

Source

pub fn is_numeric(&self) -> bool

Trait Implementations§

Source§

impl Clone for Ty

Source§

fn clone(&self) -> Ty

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
Source§

impl Debug for Ty

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Ty

Unknown is the natural default: every local/return slot starts here before any use narrows it (see the module doc on why join-from-Unknown stands in for a union-find unifier in this monomorphic, overload-free universe).

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Ty

Source§

impl From<InferredType> for Ty

Source§

fn from(t: InferredType) -> Self

Converts to this type from the input type.
Source§

impl Hash for Ty

Source§

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
Source§

impl Ord for Ty

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Ty

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Ty

A stable ordering over Ty values, used only to keep generated diagnostics/tests deterministic (never for typing decisions). Not derived Ord because Ty intentionally has no natural total order over its structural variants beyond “same shape, compare recursively”.

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Ty

Auto Trait Implementations§

§

impl Freeze for Ty

§

impl RefUnwindSafe for Ty

§

impl Send for Ty

§

impl Sync for Ty

§

impl Unpin for Ty

§

impl UnsafeUnpin for Ty

§

impl UnwindSafe for Ty

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more